0
omar created
Is it possible to get the user's role name when quering for a user.
var user = UserManager.Users.Where(e => e.Id == input.Id)
.Select(a => new UserEditDto
{
Id = a.Id,
FirstName = a.Name,
LastName = a.Surname,
Email = a.EmailAddress,
UserName = a.UserName,
RoleId = a.Roles.FirstOrDefault().RoleId // i would like Role's name instead
})
.FirstOrDefault();
Thanks
1 Answer(s)
-
0
You need to write a LINQ join between User, UserRole and Role. Or seperately query role name by role id.