Example #1
0
        public LatestBlogPost GetLatestBlogPostModel()
        {
            IPublishedContent page  = _currentPage.AncestorOrSelf(_homeDocTypeAlias);
            LatestBlogPost    model = new LatestBlogPost()
            {
                Title        = page.GetPropertyValue <string>(_latestBlogPostsTitle),
                Introduction = page.GetPropertyValue <string>(_latestBlogPostsIntroduction)
            };

            return(model);
        }
Example #2
0
        public ActionResult RenderBlog()
        {
            var homePage = CurrentPage.AncestorOrSelf("home");

            var title        = homePage.GetPropertyValue <string>("latestBlogPostsTitle");
            var introduction = homePage.GetPropertyValue("latestBlogPostsIntroduction").ToString();

            var latestBlogModel = new LatestBlogPost(title, introduction);

            return(PartialView(PARTIAL_VIEW_FOLDER + "_Blog.cshtml", latestBlogModel));
        }
        public ActionResult RenderBlog()
        {
            // short cut version to get you the home page.
            IPublishedContent homePage = CurrentPage.AncestorOrSelf("home");
            string            title    = homePage.GetPropertyValue <string>("latestBlogPostsTitle");
            string            intro    = homePage.GetPropertyValue("latestBlogPostsIntroduction").ToString(); // don't want the html
            LatestBlogPost    model    = new LatestBlogPost()
            {
                Title        = title,
                Introduction = intro
            };

            return(PartialView(PARTIAL_VIEW_FOLDER + "_Blog.cshtml", model));
        }
Example #4
0
        public ActionResult RenderBlog()
        {
            // render blog, get the home page
            IPublishedContent homePage = CurrentPage.AncestorOrSelf("home");

            // gets these two properties on the home page
            string title = homePage.GetPropertyValue <string>("latestBlogPostsTitle");
            // comes as HTML
            string introduction = homePage.GetPropertyValue("latestBlogPostsIntroduction").ToString();

            //it has created the model
            LatestBlogPost model = new LatestBlogPost(title, introduction);

            // pass the model when rendering the blog
            return(PartialView(PARTIAL_VIEW_FOLDER + "_Blog.cshtml", model));
        }