Exemplo n.º 1
0
        public async Task <IActionResult> EditRole(string id)
        {
            IdentityUser user = _userManager.GetById(id);

            if (user != null)
            {
                var userRoles             = _userManager.GetRolesByUser(user.UserName).ToList();
                var allRoles              = _roleManager.GetAll().ToList();
                ChangeRoleViewModel model = new ChangeRoleViewModel
                {
                    UserId    = user.Id,
                    UserEmail = user.Email,
                    UserRoles = userRoles,
                    AllRoles  = allRoles
                };
                return(PartialView(model));
            }

            return(NotFound());
        }