using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
I want to get a list with UserName, UserId, and a string with all the roles that the user is assigned to.
Basically, I want to return "User's Id", "UserName", "Admin, User, Guest" (roles)
What I have so far is shown below, Just don't know how to do the ????? to get the list.
_db is just public class ApplicationDbContext : IdentityDbContext<IdentityUser>
var users = from u in _db.Users
join rr in _db.UserRoles on u.Id equals rr.UserId
join r in _db.Roles on rr.RoleId equals r.Id
select new UserWithRoles { UserName = u.UserName,
UserId = u.Id,
AssignedRoles = String.Join(", ",??????) };
Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.