コード例 #1
0
        // GET: Content
        public ActionResult Index(string permalink)
        {
            string section    = "";
            string qString    = "/" + permalink;
            int    firstSlash = 0;

            if (!string.IsNullOrEmpty(permalink))
            {
                firstSlash = permalink.IndexOf('/');
            }
            if (firstSlash > 0)
            {
                section = permalink.Substring(0, firstSlash);
            }
            else
            {
                section = permalink;
            }

            ContentPage contentPage = new ContentPage(qString);

            if (contentPage.PageID != Guid.Empty)
            {
                ViewData     = contentPage.GetSections();
                ViewBag.Meta = contentPage.MetaTags;
                ViewBag.City = new MLSListings().GetCitySelectList("");

                switch (contentPage.PageTypeName)
                {
                case "Gallery Page":
                    List <GalleryItemModel> gallery = new GalleryPage(contentPage.PageID).GetImages();
                    return(View("Gallery", gallery));

                case "News Index":
                    List <NewsModel> news = new NewsSet(contentPage.PageID).News();
                    return(View("NewsIndex", news));

                case "Event Index":
                    return(View("EventIndex", new EventSet().Events()));

                default:
                    return(View());
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(contentPage.RedirectURL))
                {
                    return(RedirectPermanent(contentPage.RedirectURL));
                }
                ViewBag.City = new Listing().GetCitySelectList("");
                contentPage  = new ContentPage("404");
                Response.TrySkipIisCustomErrors = true;
                Server.ClearError();
                Response.Status     = "404 not found";
                Response.StatusCode = 404;
                return(View());
            }
        }
コード例 #2
0
        public ActionResult Create(Guid id, NewsModel data)
        {
            NewsSet news = new NewsSet(id);

            data.ModuleID = id;
            int NewsSerial = news.Add(data);

            return(RedirectToAction("Index", new { id = data.ModuleID }));
        }
コード例 #3
0
        // GET: Admin/ContentNews/<ModuleID>
        public ActionResult Index(Guid id)
        {
            NewsSet set = new NewsSet(id);

            PageModule module = new PageModule(id);

            ViewBag.Locale          = module.Locale;
            ViewBag.URL             = module.VirtualPath;
            ViewBag.PageID          = module.PageID;
            ViewBag.PageSectionName = module.PageSectionName;
            ViewBag.ModuleTypeName  = module.ModuleTypeName;
            ViewBag.ModuleName      = module.ModuleName;
            ViewBag.ModuleID        = module.ModuleID;

            return(View(set.News()));
        }