diff --git a/ManagementPage/ManagementPage/Pages/DevicePage.cshtml.cs b/ManagementPage/ManagementPage/Pages/DevicePage.cshtml.cs index efe304d..f34a1d3 100644 --- a/ManagementPage/ManagementPage/Pages/DevicePage.cshtml.cs +++ b/ManagementPage/ManagementPage/Pages/DevicePage.cshtml.cs @@ -25,11 +25,12 @@ namespace ManagementPage.Pages humidity = new List(); temperature = new List(); _dbClient = dbClient; + device = new DeviceData("","",0); } public async Task OnGetAsync() { - var deviceId = 0l ; + var deviceId = 0L; try { var idString = (string?)RouteData.Values.Where(k => k.Key == "id")?.First().Value; diff --git a/ManagementPage/ManagementPage/Pages/Shared/_Layout.cshtml b/ManagementPage/ManagementPage/Pages/Shared/_Layout.cshtml index 4ed66ee..efeb770 100644 --- a/ManagementPage/ManagementPage/Pages/Shared/_Layout.cshtml +++ b/ManagementPage/ManagementPage/Pages/Shared/_Layout.cshtml @@ -50,7 +50,7 @@ diff --git a/ManagementPage/ManagementPage/Pages/UserHome.cshtml.cs b/ManagementPage/ManagementPage/Pages/UserHome.cshtml.cs index 180711a..484ca21 100644 --- a/ManagementPage/ManagementPage/Pages/UserHome.cshtml.cs +++ b/ManagementPage/ManagementPage/Pages/UserHome.cshtml.cs @@ -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); diff --git a/ManagementPage/ManagementPage/Properties/launchSettings.json b/ManagementPage/ManagementPage/Properties/launchSettings.json index 9f5b2a5..49f37ec 100644 --- a/ManagementPage/ManagementPage/Properties/launchSettings.json +++ b/ManagementPage/ManagementPage/Properties/launchSettings.json @@ -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": {