Пример #1
0
        public ActionResult Param(ParamEditModel pm)
        {
            if (pm.Param.IsNew)
            {
                ViewBag.Title = Piranha.Resources.Settings.EditTitleNewParam;
            }
            else
            {
                ViewBag.Title = Piranha.Resources.Settings.EditTitleExistingParam;
            }

            if (ModelState.IsValid)
            {
                try {
                    if (pm.SaveAll())
                    {
                        ModelState.Clear();
                        ViewBag.Title = Piranha.Resources.Settings.EditTitleExistingParam;
                        SuccessMessage(Piranha.Resources.Settings.MessageParamSaved);
                    }
                    else
                    {
                        ErrorMessage(Piranha.Resources.Settings.MessageParamNotSaved);
                    }
                } catch (Exception e) {
                    ErrorMessage(e.ToString());
                }
            }
            return(View(@"~/Areas/Manager/Views/Settings/Param.cshtml", pm));
        }
Пример #2
0
 public ActionResult Param(string id)
 {
     if (!String.IsNullOrEmpty(id))
     {
         ViewBag.Title = Piranha.Resources.Settings.EditTitleExistingParam;
         return(View(@"~/Areas/Manager/Views/Settings/Param.cshtml", ParamEditModel.GetById(new Guid(id))));
     }
     else
     {
         ViewBag.Title = Piranha.Resources.Settings.EditTitleNewParam;
         return(View(@"~/Areas/Manager/Views/Settings/Param.cshtml", new ParamEditModel()));
     }
 }
Пример #3
0
        public ActionResult DeleteParam(string id)
        {
            ParamEditModel pm = ParamEditModel.GetById(new Guid(id));

            ViewBag.SelectedTab = "params";
            if (pm.DeleteAll())
            {
                SuccessMessage(Piranha.Resources.Settings.MessageParamDeleted);
            }
            else
            {
                ErrorMessage(Piranha.Resources.Settings.MessageParamNotDeleted);
            }

            return(ParamList());
        }