public ActionResult Index(string pageNames, string section) { string pagePath = "/" + section; if (!string.IsNullOrEmpty(pageNames)) { foreach (string pageName in pageNames.Split('/')) { if (pageName.Length > 0) { pagePath += "/" + pageName; } } } pagePath += "/"; var page = (from p in db.pages where p.pageURL.Equals(pagePath) select p).FirstOrDefault(); if (page != null) { ViewData["page_title"] = page.pageTitle; ViewData["page_text"] = page.pageContent; } ViewData["pageURL"] = pagePath; Pages pages = new Pages("/" + section + "/"); var navItems = pages.getPages(); return View(navItems); }
public PartialViewResult Sidebar(string id) { string currentController = id; if (string.IsNullOrEmpty(id)) { var rd = ControllerContext.ParentActionViewContext.RouteData; currentController = rd.GetRequiredString("controller"); } Pages pages = new Pages("/" + currentController + "/"); var navItems = pages.getPages(); ViewData["pageURL"] = currentController; return PartialView(navItems); }
public ActionResult PagePreview(int id) { var page = (from p in db.pages where p.pageID.Equals(id) select p).FirstOrDefault(); var parentPage = (from p in db.pages where p.pageID == page.parent select p).FirstOrDefault(); ViewData["pageheader"] = parentPage.pageTitle; if (page != null) { ViewData["page_title"] = page.pageTitle; ViewData["page_text"] = page.pageContent; } Pages pages = new Pages(parentPage.pageURL); var navItems = pages.getPages(); return View(navItems); }