public ActionResult Index(RenderModel model, int?p) { //create a master model var masterModel = new MasterModel(model.Content); var listNodes = masterModel.RootBlogNode.Children("ArticulateArchive").ToArray(); if (listNodes.Length == 0) { throw new InvalidOperationException("An ArticulateArchive document must exist under the root Articulate document"); } var totalPosts = Umbraco.GetPostCount(model.Content.Name, listNodes.Select(x => x.Id).ToArray()); PagerModel pager; if (!GetPagerModel(masterModel, totalPosts, p, out pager)) { return(new RedirectToUmbracoPageResult(model.Content.Parent, UmbracoContext)); } var authorPosts = Umbraco.GetContentByAuthor(listNodes, model.Content.Name, pager); var author = new AuthorModel(model.Content, authorPosts, pager, totalPosts); return(View(PathHelper.GetThemeViewPath(author, "Author"), author)); }
public ActionResult Author(RenderModel model, int authorId, int?maxItems) { var author = Umbraco.TypedContent(authorId); if (author == null) { throw new ArgumentNullException(nameof(author)); } if (!maxItems.HasValue) { maxItems = 25; } //create a master model var masterModel = new MasterModel(author); var listNodes = masterModel.RootBlogNode.Children("ArticulateArchive").ToArray(); var authorContenet = Umbraco.GetContentByAuthor(listNodes, author.Name, new PagerModel(maxItems.Value, 0, 1)); var feed = FeedGenerator.GetFeed(masterModel, authorContenet.Select(x => new PostModel(x))); return(new RssResult(feed, masterModel)); }