public ActionResult Edit(UserEdit model, IEnumerable <PermissionFlagEntry> permissions) { PermissionContext.VerifyPermission(PermissionToken.ManageUserPermissions); model.EditableGroups = UserEdit.GetEditableGroups(_loginManager); model.OldName = Service.GetUser(model.Id).Name; if (permissions != null) { model.Permissions = permissions.ToArray(); } if (!ModelState.IsValid) { return(View(model)); } try { Data.UpdateUser(model.ToContract()); } catch (InvalidEmailFormatException) { ModelState.AddModelError("Email", ViewRes.User.MySettingsStrings.InvalidEmail); return(View(model)); } catch (UserNameAlreadyExistsException) { ModelState.AddModelError("Username", "Username is already in use."); return(View(model)); } return(RedirectToAction("Details", new { id = model.Id })); }
public ActionResult Edit(UserEdit model, IEnumerable <PermissionFlagEntry> permissions) { PermissionContext.VerifyPermission(PermissionToken.ManageUserPermissions); if (permissions != null) { model.Permissions = permissions.ToArray(); } Data.UpdateUser(model.ToContract()); return(RedirectToAction("Details", new { id = model.Id })); }