0

I am using .Net Core Identity 5, I did add Role for the user when registering the account. I want when I Edit the user information of that account, I can change their Role in the system. I am working in Repo, how can I work with it most effectively?

Viewmodel

    public class UserRoleViewModel
    {
        public string UserId { get; set; }
        public string FullName { get; set; }
        public string Email { get; set; }
        public string Role { get; set; }
    }
Huy Nguyen
  • 27
  • 7
  • [This](https://stackoverflow.com/questions/23999926/updating-user-role-using-asp-net-identity) might help ! not sure what exactly are you looking for. I suggest you can once go through the concepts of identity. – Dave Mar 18 '21 at 10:27
  • I have tried it but it doesn't seem to be successful – Huy Nguyen Mar 18 '21 at 10:47
  • Any errors you getting ? – Dave Mar 18 '21 at 10:49
  • I have been trying it out since yesterday, I made various changes so I am not sure what the error is. – Huy Nguyen Mar 18 '21 at 11:27
  • I have updated to add a Repo to show my User including Role, how can I get UserRole Id from it? – Huy Nguyen Mar 18 '21 at 11:30
  • I don't quite understand what you mean, but you can get all users like the following:`var user = await _userManager.Users.Include(x => x.Role).Tolist()` – Yinqiu Mar 19 '21 at 03:18

0 Answers0