/// <summary> /// Display the homepage/mainpage. If no page has been tagged with the 'homepage' tag, /// then a dummy PageSummary is put in its place. /// </summary> public ActionResult Index() { PageManager manager = new PageManager(); // Get the first locked homepage PageSummary summary = manager.FindByTag("homepage").FirstOrDefault(h => h.IsLocked); if (summary == null) { // Look for a none-locked page as a fallback summary = manager.FindByTag("homepage").FirstOrDefault(); } if (summary == null) { summary = new PageSummary(); summary.Title = "You have no mainpage set"; summary.Content = "To set a main page, create a page and assign the tag 'homepage' to it."; summary.CreatedBy = ""; summary.CreatedOn = DateTime.Now; summary.Tags = "homepage"; summary.ModifiedOn = DateTime.Now; summary.ModifiedBy = ""; } RoadkillContext.Current.Page = summary; return View(summary); }
/// <summary> /// Display the homepage/mainpage. If no page has been tagged with the 'homepage' tag, /// then a dummy PageSummary is put in its place. /// </summary> public ActionResult Index() { PageManager manager = new PageManager(); // Get the first locked homepage PageSummary summary = manager.FindByTag("homepage").FirstOrDefault(h => h.IsLocked); if (summary == null) { // Look for a none-locked page as a fallback summary = manager.FindByTag("homepage").FirstOrDefault(); } if (summary == null) { summary = new PageSummary(); summary.Title = SiteStrings.NoMainPage_Title; summary.Content = SiteStrings.NoMainPage_Label; summary.CreatedBy = ""; summary.CreatedOn = DateTime.Now; summary.Tags = "homepage"; summary.ModifiedOn = DateTime.Now; summary.ModifiedBy = ""; } RoadkillContext.Current.Page = summary; return View(summary); }
/// <summary> /// Returns all pages for the given tag. /// </summary> /// <param name="id">The tag name</param> /// <returns>An <see cref="IEnumerable`PageSummary"/> as the model.</returns> public ActionResult Tag(string id) { ViewData["Tagname"] = id; PageManager manager = new PageManager(); return View(manager.FindByTag(id)); }