I can't seem to list the Identity users in a Blazor Client page using typical HTML. The reason is, I can't seem to get to the userManager.Users.ToList() in the Client-side.
This project is VS-2022, CORE-6, Blazor webassembly hosted with a SQL Server database.
My goal would be to have an Administrator (role) to CRUD "employees".
The starting point for me is "list the users that are in AspNetUsers table". I have been unable to do so. I want to use the Identity: UserManager, RoleManager and Claims, but seem unable to get to these objects from the client-side.
I seek snippets of code that shows the code in SHARED, SERVER and CLIENT projects.
There is a similiar question without an answer at this link: How to list all the Users in a Blazor Webassembly hosted application with Identity? .
Your comments, questions and solutions are welcome. Thanks.
CodePudding user response:
"list the users that are in AspNetUsers table".
The web assembly is runing at the client side, so we couldn't use usermanager to call the server-side EF core to query the table and get the user table's result.
I suggest you could create a backend web api or other page action and use the Blazor to call it.
About how to use Blazor to call the backend method, I suggest you could refer to this article.
