public async Task <IActionResult> ChangeUserRoles(int userId, int[] roleIds) { User thisUser = null; var result = await _userManager.AddOrUpdateUserRolesAsync( userId, roleIds, user => thisUser = user); if (!result.Succeeded) { return(BadRequest(error: result.DumpErrors(useHtmlNewLine: true))); } return(await returnUserCardPartialView(thisUser)); }
public async Task <IActionResult> ChangeUserRoles(int userId, List <int> roleIds) { User thisUser = null; var result = await _userManager.AddOrUpdateUserRolesAsync( userId, roleIds, user => thisUser = user); if (!result.Succeeded) { return(BadRequest(error: result.DumpErrors(useHtmlNewLine: true))); } return(RedirectToAction(nameof(Index))); }