public ActionResult SiteTemplateUpdate(SiteTemplateUpdateModel model) { ContentPage pageHome = pageHelper.FindHome(this.SiteID, true); ContentPage pageIndex = null; SiteData.CurrentSite.Blog_Root_ContentID = model.IndexPageID; if (model.IndexPageID.HasValue) { pageIndex = pageHelper.FindContentByID(this.SiteID, model.IndexPageID.Value); } SiteData.CurrentSite.Save(); if (!String.IsNullOrEmpty(model.BlogPages)) { pageHelper.UpdateAllBlogTemplates(this.SiteID, model.BlogPages); } if (!String.IsNullOrEmpty(model.AllPages)) { pageHelper.UpdateAllPageTemplates(this.SiteID, model.AllPages); } if (!String.IsNullOrEmpty(model.TopPages)) { pageHelper.UpdateTopPageTemplates(this.SiteID, model.TopPages); } if (!String.IsNullOrEmpty(model.SubPages)) { pageHelper.UpdateSubPageTemplates(this.SiteID, model.SubPages); } if (pageHome != null && !String.IsNullOrEmpty(model.HomePage)) { pageHome.TemplateFile = model.HomePage; pageHome.ApplyTemplate(); } if (pageIndex != null && !String.IsNullOrEmpty(model.IndexPage)) { pageIndex.TemplateFile = model.IndexPage; pageIndex.ApplyTemplate(); } if (!String.IsNullOrEmpty(model.AllContent)) { pageHelper.UpdateAllContentTemplates(this.SiteID, model.AllContent); } return RedirectToAction("SiteTemplateUpdate"); }
public ActionResult SiteTemplateUpdate() { SiteTemplateUpdateModel model = new SiteTemplateUpdateModel(); ContentPage pageHome = pageHelper.FindHome(this.SiteID, true); ContentPage pageIndex = null; if (pageHome != null) { model.HomePage = pageHome.TemplateFile.ToLowerInvariant(); model.HomePageTitle = pageHome.NavMenuText; model.HomePageLink = pageHome.FileName; if (SiteData.CurrentSite.Blog_Root_ContentID.HasValue) { pageIndex = pageHelper.FindContentByID(this.SiteID, SiteData.CurrentSite.Blog_Root_ContentID.Value); model.IndexPageID = SiteData.CurrentSite.Blog_Root_ContentID.Value; model.IndexPage = pageIndex.TemplateFile.ToLowerInvariant(); } } return View(model); }