示例#1
0
 public ContentPage GetPrimary()
 {
     ContentPage content = new ContentPage();
     try {
         CurtDevDataContext db = new CurtDevDataContext();
         content = (from s in db.SiteContents
                    where s.isPrimary == true && s.websiteID.Equals(this.websiteID)
                    select new ContentPage {
                        contentID = s.contentID,
                        page_title = s.page_title,
                        content_type = s.content_type,
                        lastModified = s.lastModified,
                        createdDate = s.createdDate,
                        published = s.published,
                        meta_title = s.meta_title,
                        meta_description = s.meta_description,
                        canonical = s.canonical,
                        keywords = s.keywords,
                        active = s.active,
                        isPrimary = s.isPrimary,
                        slug = s.slug,
                        requireAuthentication = s.requireAuthentication,
                        revision = (db.SiteContentRevisions.Where(x => x.contentID == s.contentID).Where(x => x.active == true).First<SiteContentRevision>())
                    }).First<ContentPage>();
         return content;
     } catch { return content; }
 }
示例#2
0
 public ContentPage Get(string name = "", int menuid = 0, bool authenticated = false)
 {
     ContentPage content = new ContentPage();
     try {
         CurtDevDataContext db = new CurtDevDataContext();
         content = (from s in db.SiteContents
                    where s.slug == name && s.published == true && s.active == true && s.websiteID.Equals(this.websiteID)
                    select new ContentPage {
                        contentID = s.contentID,
                        page_title = s.page_title,
                        content_type = s.content_type,
                        lastModified = s.lastModified,
                        createdDate = s.createdDate,
                        published = s.published,
                        meta_title = s.meta_title,
                        meta_description = s.meta_description,
                        keywords = s.keywords,
                        canonical = s.canonical,
                        active = s.active,
                        isPrimary = s.isPrimary,
                        slug = s.slug,
                        requireAuthentication = s.requireAuthentication,
                        revision = (db.SiteContentRevisions.Where(x => x.contentID == s.contentID).Where(x => x.active == true).First<SiteContentRevision>()),
                        menu = new MenuModel().GetByContentID(s.contentID, menuid, authenticated)
                    }).First<ContentPage>();
         return content;
     } catch (Exception e) { return content; }
 }
示例#3
0
        //
        // GET: /Index/
        public ActionResult Index()
        {
            ContentPage content = new ContentPage();
            content = new SiteContentModel().GetPrimary();
            ViewBag.content = content;

            List<NewsItem> news = new List<NewsItem>();
            news = NewsModel.GetLatest();
            ViewBag.news = news;

            List<Testimonial> testimonials = new List<Testimonial>();
            testimonials = TestimonialModel.GetRandomFive();
            ViewBag.testimonials = testimonials;

            /*List<APIPart> parts = new List<APIPart>();
            parts = Hitch_API.getLatestParts();
            ViewBag.parts = parts;*/

            return View();
        }
示例#4
0
        //
        // GET: /Dealer/
        public ActionResult Index()
        {
            if (!AuthenticateModel.checkAuth(Request.Cookies.Get("customerID"))) {
                string message = "Authentication is required to view that content. Please login using the form below.";
                return RedirectToAction("Login", new { message = message });
            }

            menuWithContent dealermenu = new MenuModel().Get("dealerarea");
            ViewBag.dealermenu = dealermenu;
            ContentPage content = new ContentPage();
            foreach (menuItem item in dealermenu.getChildren()) {
                if (item.hasContent()) {
                    content = item.content;
                    break;
                }
            }
            ViewBag.content = content;

            return View();
        }