Example #1
0
        /// <summary>
        /// Method determines whether "pageName" is a "real" view and controller entry, or a virtual page.
        /// If it is a "real" view, the real view is called.
        /// Else a page entry is searched for in the DB.  If it isn't found, display a groovy 404 page.
        /// </summary>
        /// <param name="pageName"></param>
        /// <param name="param1"></param>
        /// <param name="param2"></param>
        /// <returns></returns>
        public ActionResult Router(string url)
        {
            if (string.IsNullOrEmpty(url))
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                var firstSegment = GetFirstSegment(url, '/');

                //this is a page that is included in our CMS (page viewable via the DB)
                CMSPage cmsPage = new CMSPage();
                cmsPage = cmsPage.GetPage(firstSegment);
                if (cmsPage != null)
                {
                    return(View("CMSPage", cmsPage));
                }
                else
                {
                    return(View("NoJoy"));
                }
            }
        }