public ViewResult Edit(int id, string returnUrl) { var model = new EditViewModel { UserProfile = this.UserProfileRepository.Find(id), ReturnUrl = returnUrl }; var currentRoles = this.roles.GetRolesForUser(model.UserProfile.UserName).ToList(); model.IsAdmin = currentRoles.Contains(ApplicationRole.Admin); model.IsInstitutionAdmin = currentRoles.Contains(ApplicationRole.InstitutionAdmin); model.IsDataAdmin = currentRoles.Contains(ApplicationRole.DataAdmin); return this.View(model); }
public ActionResult Edit(int id, EditViewModel model) { model.UserProfile = this.UserProfileRepository.Find(id); if (this.ModelState.IsValid) { this.roles.UpdateUserRoles(model.UserProfile.UserName, model.Roles); return this.Redirect(model.ReturnUrl); } return this.View(model); }