Add device page filter
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Simon 2021-10-05 23:43:23 +01:00
parent 26017568f0
commit d7c38191ce
4 changed files with 7 additions and 9 deletions

View File

@ -25,11 +25,12 @@ namespace ManagementPage.Pages
humidity = new List<DataSet>();
temperature = new List<DataSet>();
_dbClient = dbClient;
device = new DeviceData("","",0);
}
public async Task<IActionResult> OnGetAsync()
{
var deviceId = 0l ;
var deviceId = 0L;
try
{
var idString = (string?)RouteData.Values.Where(k => k.Key == "id")?.First().Value;

View File

@ -50,7 +50,7 @@
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2021 - ManagementPage - <a asp-area="" asp-page="/Privacy">Privacy</a>
&copy; 2021 - 51m0n</a>
</div>
</footer>

View File

@ -44,12 +44,9 @@ namespace ManagementPage.Pages
var id = await binder.GetLocalAccount(User.FindFirstValue(ClaimTypes.NameIdentifier));
name = User.FindFirstValue(ClaimTypes.GivenName);
data.Clear();
_dbClient.DeviceCollection.AsQueryable().Where(s => id.Devices.Contains(s._id)).ToArray();
using var cursor = await _dbClient.DeviceCollection.FindAsync(new BsonDocument());
data = cursor.ToList();
data.AddRange(_dbClient.DeviceCollection.AsQueryable().Where(s => id.Devices.Contains(s._id)).ToArray());
foreach (var item in data)
{
@ -66,7 +63,7 @@ namespace ManagementPage.Pages
{
return Page();
}
var id = BitConverter.ToInt64(Guid.NewGuid().ToByteArray(),4);
var id = BitConverter.ToInt64(Guid.NewGuid().ToByteArray(), 4);
var device = new DeviceData(NewDevice.Name, NewDevice.Passcode, id);
device._id = ObjectId.GenerateNewId();
await _dbClient.DeviceCollection.InsertOneAsync(device);

View File

@ -14,7 +14,7 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://environment.51m0n.com;http://+:80",
"applicationUrl": "https://localhost:443;http://+:80",
"dotnetRunMessages": true
},
"IIS Express": {