Get list of roles in asp net core

kudvenkat
kudvenkat
68.7 هزار بار بازدید - 5 سال پیش - How to retrieve and display
How to retrieve and display all roles in asp.net core using the Identity API.

Text version of the video
https://csharp-video-tutorials.blogsp...

Healthy diet is very important for both body and mind. We want to inspire you to cook and eat healthy. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking.
@aarvikitchen5572

Slides
https://csharp-video-tutorials.blogsp...

ASP.NET Core Text Articles & Slides
https://csharp-video-tutorials.blogsp...

ASP.NET Core Tutorial
ASP.NET core tutorial for beginners

Angular, JavaScript, jQuery, Dot Net & SQL Playlists
https://www.youtube.com/user/kudvenka...


We want to display
1. Role ID
2. Role Name and
3. A pair of buttons to Edit and Delete a role

Roles property of RoleManager class

Roles property of RoleManager class returns the list of all IdentityRole objects
Pass the list of IdentityRole objects to the view for display

[HttpGet]
public IActionResult ListRoles()
{
   var roles = roleManager.Roles;
   return View(roles);
}

List Roles View

ID property of the IdentityRole object returns the role ID
Name property of the IdentityRole object returns the role Name
We are using Bootstrap 4 cards for styling the list of roles
5 سال پیش در تاریخ 1398/04/17 منتشر شده است.
68,705 بـار بازدید شده
... بیشتر