public ActionResult BlogPostAddEdit(ContentPageModel model) { Helper.ForceValidation(ModelState, model); model.Mode = (String.IsNullOrEmpty(model.Mode) || model.Mode.Trim().ToLower() != "raw") ? "html" : "raw"; ViewBag.ContentEditMode = model.Mode; if (ModelState.IsValid) { ContentPage page = model.ContentPage; var pageContents = pageHelper.FindContentByID(this.SiteID, page.Root_ContentID); if (pageContents == null) { pageContents = new ContentPage(this.SiteID, ContentPageType.PageType.BlogEntry); } pageContents.GoLiveDate = page.GoLiveDate; pageContents.RetireDate = page.RetireDate; pageContents.IsLatestVersion = true; pageContents.Thumbnail = page.Thumbnail; pageContents.TemplateFile = page.TemplateFile; pageContents.TitleBar = page.TitleBar; pageContents.NavMenuText = page.NavMenuText; pageContents.PageHead = page.PageHead; pageContents.FileName = page.FileName; pageContents.PageSlug = page.PageSlug; pageContents.MetaDescription = page.MetaDescription; pageContents.MetaKeyword = page.MetaKeyword; pageContents.EditDate = SiteData.CurrentSite.Now; pageContents.NavOrder = SiteData.BlogSortOrderNumber; pageContents.PageText = page.PageText; pageContents.LeftPageText = page.LeftPageText; pageContents.RightPageText = page.RightPageText; pageContents.PageActive = page.PageActive; pageContents.ShowInSiteNav = false; pageContents.ShowInSiteMap = false; pageContents.BlockIndex = page.BlockIndex; pageContents.Parent_ContentID = page.Parent_ContentID; pageContents.CreditUserId = page.CreditUserId; pageContents.EditUserId = SecurityData.CurrentUserGuid; List<ContentCategory> lstCat = new List<ContentCategory>(); List<ContentTag> lstTag = new List<ContentTag>(); //lstCat = (from cr in model.CategoryOptions // join l in SiteData.CurrentSite.GetCategoryList() on cr.Value equals l.ContentCategoryID.ToString() // where cr.Selected // select l).ToList(); //lstTag = (from cr in model.TagOptions // join l in SiteData.CurrentSite.GetTagList() on cr.Value equals l.ContentTagID.ToString() // where cr.Selected // select l).ToList(); lstCat = (from l in SiteData.CurrentSite.GetCategoryList() join cr in model.SelectedCategories on l.ContentCategoryID.ToString().ToLower() equals cr.ToLower() select l).ToList(); lstTag = (from l in SiteData.CurrentSite.GetTagList() join cr in model.SelectedTags on l.ContentTagID.ToString().ToLower() equals cr.ToLower() select l).ToList(); pageContents.ContentCategories = lstCat; pageContents.ContentTags = lstTag; pageContents.SavePageEdit(); model.SaveTextWidgets(); if (model.VisitPage) { Response.Redirect(pageContents.FileName); } else { return RedirectToAction("BlogPostAddEdit", new { @id = pageContents.Root_ContentID, @mode = model.Mode }); } } Helper.HandleErrorDict(ModelState); model.RefreshWidgetList(); return View(model); }
public ActionResult BlogPostAddEdit(ContentPageModel model) { Helper.ForceValidation(ModelState, model); model.Mode = (String.IsNullOrEmpty(model.Mode) || model.Mode.Trim().ToLowerInvariant() != "raw") ? "html" : "raw"; ViewBag.ContentEditMode = model.Mode; if (ModelState.IsValid) { var pageContents = model.SavePost(); if (model.VisitPage) { Response.Redirect(pageContents.FileName); } else { return RedirectToAction("BlogPostAddEdit", new { @id = pageContents.Root_ContentID, @mode = model.Mode }); } } Helper.HandleErrorDict(ModelState); model.RefreshWidgetList(); return View(model); }
public ActionResult PageAddEdit(ContentPageModel model) { Helper.ForceValidation(ModelState, model); model.Mode = (String.IsNullOrEmpty(model.Mode) || model.Mode.Trim().ToLower() != "raw") ? "html" : "raw"; ViewBag.ContentEditMode = model.Mode; if (ModelState.IsValid) { ContentPage page = model.ContentPage; var pageContents = pageHelper.FindContentByID(this.SiteID, page.Root_ContentID); if (pageContents == null) { pageContents = new ContentPage(this.SiteID, ContentPageType.PageType.ContentEntry); } pageContents.GoLiveDate = page.GoLiveDate; pageContents.RetireDate = page.RetireDate; pageContents.IsLatestVersion = true; pageContents.Thumbnail = page.Thumbnail; pageContents.TemplateFile = page.TemplateFile; pageContents.TitleBar = page.TitleBar; pageContents.NavMenuText = page.NavMenuText; pageContents.PageHead = page.PageHead; pageContents.FileName = page.FileName; pageContents.PageSlug = null; pageContents.MetaDescription = page.MetaDescription; pageContents.MetaKeyword = page.MetaKeyword; pageContents.EditDate = SiteData.CurrentSite.Now; pageContents.NavOrder = page.NavOrder; pageContents.PageText = page.PageText; pageContents.LeftPageText = page.LeftPageText; pageContents.RightPageText = page.RightPageText; pageContents.PageActive = page.PageActive; pageContents.ShowInSiteNav = page.ShowInSiteNav; pageContents.ShowInSiteMap = page.ShowInSiteMap; pageContents.BlockIndex = page.BlockIndex; pageContents.Parent_ContentID = page.Parent_ContentID; pageContents.CreditUserId = page.CreditUserId; pageContents.EditUserId = SecurityData.CurrentUserGuid; pageContents.SavePageEdit(); model.SaveTextWidgets(); if (model.VisitPage) { Response.Redirect(pageContents.FileName); } else { return RedirectToAction("PageAddEdit", new { @id = pageContents.Root_ContentID, @mode = model.Mode }); } } Helper.HandleErrorDict(ModelState); model.RefreshWidgetList(); return View(model); }