From 623a7369ae0f3206a6c9f794d17eaf10b1bb2357 Mon Sep 17 00:00:00 2001 From: Frank Liu Date: Tue, 11 Jun 2024 15:34:43 -0400 Subject: [PATCH] Use UserManager to get users list --- .../Account/Pages/ManageUsers.razor | 47 +++++++++++++++++++ IMS.sln | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 IMS.WebApp/Components/Account/Pages/ManageUsers.razor diff --git a/IMS.WebApp/Components/Account/Pages/ManageUsers.razor b/IMS.WebApp/Components/Account/Pages/ManageUsers.razor new file mode 100644 index 0000000..3e81bfc --- /dev/null +++ b/IMS.WebApp/Components/Account/Pages/ManageUsers.razor @@ -0,0 +1,47 @@ +@page "/Account/ManageUsers" +@using IMS.WebApp.Data +@using Microsoft.AspNetCore.Identity + +@attribute [Authorize(Policy = "Admin")] + +@inject UserManager UserManager + +

Manage Users

+
+ +@if (users is not null && users.Count > 0) +{ + + + + + + + + + @foreach(var user in users) + { + + + + + } + +
User
+ @user.Email + + Manage +
+} + +@code { + private List? users; + + protected override void OnInitialized() + { + base.OnInitialized(); + + users = UserManager.Users.ToList(); + } + +} diff --git a/IMS.sln b/IMS.sln index ad5d9fc..1b08b03 100644 --- a/IMS.sln +++ b/IMS.sln @@ -13,7 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IMS.Plugins", "IMS.Plugins" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IMS.Plugins.InMemory", "IMS.Plugins\IMS.Plugins.InMemory\IMS.Plugins.InMemory.csproj", "{292713AF-9940-4CF3-AA95-8AAE41E07A23}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IMS.Plugins.EFCoreSqlServer", "IMS.Plugins\IMS.Plugins.EFCoreSqlServer\IMS.Plugins.EFCoreSqlServer.csproj", "{44417527-BE6D-4A2C-9180-4775B15AB852}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IMS.Plugins.EFCoreSqlServer", "IMS.Plugins\IMS.Plugins.EFCoreSqlServer\IMS.Plugins.EFCoreSqlServer.csproj", "{44417527-BE6D-4A2C-9180-4775B15AB852}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution