Ejemplo n.º 1
0
        public ActionResult Create(PageManageModel model, SubmitTypeEnums submit)
        {
            if (ModelState.IsValid)
            {
                var response = _pageServices.SavePageManageModel(model);
                if (response.Success)
                {
                    var pageId = (int)response.Data;
                    SetSuccessMessage(response.Message);
                    switch (submit)
                    {
                    case SubmitTypeEnums.Save:
                        return(RedirectToAction("Index"));

                    default:
                        return(RedirectToAction("Edit", new { id = pageId }));
                    }
                }
                SetErrorMessage(response.Message);
            }
            model.Parents       = _pageTemplateServices.GetPossibleParents();
            model.Positions     = EnumUtilities.GetSelectListFromEnum <PageEnums.PositionEnums>();
            model.RelativePages = _pageServices.GetRelativePages(model.Id, model.ParentId);
            model.StatusList    = _pageServices.GetStatus();
            model.PageTemplates = _pageTemplateServices.GetPageTemplateSelectList(model.PageTemplateId);
            return(View(model));
        }