Esempio n. 1
0
		public ActionResult Group(GroupEditModel gm) {
			if (gm.Group.IsNew)
				ViewBag.Title = Piranha.Resources.Settings.EditTitleNewGroup ;
			else ViewBag.Title = Piranha.Resources.Settings.EditTitleExistingGroup ;

			// Check so that no groups are saved without a parent except the system administrator.
			if (gm.Group.ParentId == Guid.Empty && gm.Group.Id != Config.SysAdminGroupId)
				ModelState.AddModelError("Group.ParentId", Resources.Settings.GroupParentIdRequired) ;

			if (ModelState.IsValid) {
				try {
					if (gm.SaveAll()) {
						ModelState.Clear() ;
						ViewBag.Title = Piranha.Resources.Settings.EditTitleExistingGroup ;
						SuccessMessage(Piranha.Resources.Settings.MessageGroupSaved) ;
					} else ErrorMessage(Piranha.Resources.Settings.MessageGroupNotSaved) ;
				} catch (Exception e) {
					ErrorMessage(e.ToString()) ;
				}
			}
			gm.Refresh() ;
			return View(@"~/Areas/Manager/Views/Settings/Group.cshtml", gm) ;
		}
Esempio n. 2
0
        public ActionResult Group(GroupEditModel gm)
        {
            if (gm.Group.IsNew)
                ViewBag.Title = Piranha.Resources.Settings.EditTitleNewGroup ;
            else ViewBag.Title = Piranha.Resources.Settings.EditTitleExistingGroup ;

            if (ModelState.IsValid) {
                try {
                    if (gm.SaveAll()) {
                        ModelState.Clear() ;
                        ViewBag.Title = Piranha.Resources.Settings.EditTitleExistingGroup ;
                        SuccessMessage(Piranha.Resources.Settings.MessageGroupSaved) ;
                    } else ErrorMessage(Piranha.Resources.Settings.MessageGroupNotSaved) ;
                } catch (Exception e) {
                    ErrorMessage(e.ToString()) ;
                }
            }
            gm.Refresh() ;
            return View("Group", gm) ;
        }