public CMSPageDisplay ToDisplay() { CMSPageDisplay display = new CMSPageDisplay(); display.Id = Id; display.UserId = UserId; display.Url = Url; display.MetaDescription = MetaDescription; display.MetaTag = MetaTag; display.Name = Name; display.PubDate = PubDate; display.Template = Template; display.DateModified = DateModified; display.ExpireDate = ExpireDate; display.Active = Active; display.IncludeInNavigation = IncludeInNavigation; display.Content = new Dictionary<string, string>(); foreach (CMSContentItem item in Content) { if (!display.Content.ContainsKey(item.KeyName)) { display.Content.Add(item.KeyName, item.Value); } } return display; }
public ActionResult Index() { List<CMSPageDisplay> slides = new List<CMSPageDisplay>(); CMSPageDisplay splash = new CMSPageDisplay(); CMSPage slide1 = _cmsService.SelectAllByPath("home-slide-1"); CMSPage slide2 = _cmsService.SelectAllByPath("home-slide-2"); CMSPage slide3 = _cmsService.SelectAllByPath("home-slide-3"); CMSPage splashContent = _cmsService.SelectAllByPath("splash-content"); if (slide1 != null) slides.Add(slide1.ToDisplay()); if (slide2 != null) slides.Add(slide2.ToDisplay()); if (slide3 != null) slides.Add(slide3.ToDisplay()); if (splashContent != null) splash = (splashContent.ToDisplay()); CmsContentGroupViewModel model = new CmsContentGroupViewModel(); model.Pages = slides; model.Splash = splash; return View(model); }