public new ActionResult User(UserEditModel um) { if (um.User.IsNew) ViewBag.Title = Piranha.Resources.Settings.EditTitleNewUser ; else ViewBag.Title = Piranha.Resources.Settings.EditTitleExistingUser ; if (ModelState.IsValid) { try { if (um.SaveAll()) { ModelState.Clear() ; ViewBag.Title = Piranha.Resources.Settings.EditTitleExistingUser ; SuccessMessage(Piranha.Resources.Settings.MessageUserSaved) ; } else ErrorMessage(Piranha.Resources.Settings.MessageUserNotSaved) ; } catch (Exception e) { ErrorMessage(e.ToString()) ; } } return View(@"~/Areas/Manager/Views/Settings/User.cshtml", um) ; }
public new ActionResult User(UserEditModel um) { if (um.User.IsNew) ViewBag.Title = Piranha.Resources.Settings.EditTitleNewUser ; else ViewBag.Title = Piranha.Resources.Settings.EditTitleExistingUser ; // Check so that users are not saved without a group if (um.User.GroupId == Guid.Empty) ModelState.AddModelError("User.GroupId", Resources.Settings.UserGroupIdRequired) ; if (ModelState.IsValid) { try { if (um.SaveAll()) { ModelState.Clear() ; ViewBag.Title = Piranha.Resources.Settings.EditTitleExistingUser ; SuccessMessage(Piranha.Resources.Settings.MessageUserSaved) ; } else ErrorMessage(Piranha.Resources.Settings.MessageUserNotSaved) ; } catch (Exception e) { ErrorMessage(e.ToString()) ; } } return View(@"~/Areas/Manager/Views/Settings/User.cshtml", um) ; }
public new ActionResult User(UserEditModel um) { if (um.User.IsNew) ViewBag.Title = Piranha.Resources.Settings.EditTitleNewUser ; else ViewBag.Title = Piranha.Resources.Settings.EditTitleExistingUser ; // Check so that users are not saved without a group if (um.User.GroupId == Guid.Empty) ModelState.AddModelError("User.GroupId", Resources.Settings.UserGroupIdRequired) ; if (ModelState.IsValid) { try { // Executes the user edit before save hook, if registered if (WebPages.Hooks.Manager.UserEditModelBeforeSave != null) WebPages.Hooks.Manager.UserEditModelBeforeSave(this, WebPages.Manager.GetActiveMenuItem(), um) ; if (um.SaveAll()) { // Executes the user edit after save hook, if registered if (WebPages.Hooks.Manager.UserEditModelAfterSave != null) WebPages.Hooks.Manager.UserEditModelAfterSave(this, WebPages.Manager.GetActiveMenuItem(), um) ; ModelState.Clear() ; ViewBag.Title = Piranha.Resources.Settings.EditTitleExistingUser ; SuccessMessage(Piranha.Resources.Settings.MessageUserSaved) ; } else ErrorMessage(Piranha.Resources.Settings.MessageUserNotSaved) ; } catch (Exception e) { ErrorMessage(e.ToString()) ; } } return View(@"~/Areas/Manager/Views/Settings/User.cshtml", um) ; }