private ActionResult RenderView(ContentModel model, int?p = null)
        {
            var listNodes = model.Content.ChildrenOfType("ArticulateArchive").ToArray();

            if (listNodes.Length == 0)
            {
                throw new InvalidOperationException("An ArticulateArchive document must exist under the root Articulate document");
            }

            var master = new MasterModel(model.Content);

            var count = Umbraco.GetPostCount(listNodes.Select(x => x.Id).ToArray());

            var posts = Umbraco.GetRecentPosts(master, p ?? 1, master.PageSize);

            return(GetPagedListView(master, listNodes[0], posts, count, p));
        }
Esempio n. 2
0
        public ActionResult GetPosts(int id, int page)
        {
            var content = Umbraco.TypedContent(id);

            var master = new MasterModel(content);

            var count = Umbraco.GetPostCount(id);

            var posts = Umbraco.GetRecentPosts(master, page, master.PageSize);

            var viewPath = PathHelper.GetThemePartialViewPath(master, "ListPost");

            var html = string.Empty;

            foreach (var post in posts)
            {
                html += RenderViewToString(this, viewPath, post, true);
            }

            return(Content(html));
        }