public async Task <IActionResult> UpdateRoles(string userId) { var user = await userManager.FindByIdAsync(userId); var updateRolesView = new UpdateRolesView(userId, roleManager.Roles.ToList(), await userManager.GetRolesAsync(user)); return(View(updateRolesView)); }
public async Task <IActionResult> UpdateRoles(string userId, string[] roleIds) { var user = await userManager.FindByIdAsync(userId); var updateRolesView = new UpdateRolesView(userId, roleManager.Roles.ToList(), await userManager.GetRolesAsync(user)); if (roleIds.Any()) { using (userRepository) { userRepository.UpdateRoles(userId, roleIds); } } ViewBag.PageInfo = new PageInfo("Roles has been added successfully.", PageInfo.INFO); return(View(updateRolesView)); }