public async Task <IActionResult> UpdateUser(UserViewModel model) { ViewData["Title"] = "Edit a User"; var user = await UserManagerAgent.FindByNameAsync(model?.UserName).ConfigureAwait(false); user.FirstName = model.FirstName; user.LastName = model.LastName; user.Email = model.Email; await UserManagerAgent.UpdateAsync(user).ConfigureAwait(false); model = _mapper.Map <UserViewModel>(user); model.MemberRoles.AddRange(await UserManagerAgent.GetRolesAsync(user).ConfigureAwait(false)); model.AllRoles.AddRange(GetAllRolesAsSelectList()); return(View("EditUser", model)); }