public ActionResult PostPage(string bid = null, int pageNum = 1) { if (pageNum < 1) pageNum = 1; if (bid == null) bid = blogId; BlogHomeVModel bhvm = new BlogHomeVModel(); bhvm.BlogId = bid; IQueryable<SeqPost> results = postsRep.GetPostPage(pageSize, pageNum, bid); bhvm.RecentPosts = VModelFactory.BlogPosts(results); bhvm.AllCategories = VModelFactory.AllCategories(catRep.AllCategories(bid),bid); bhvm.CurrentPage = pageNum; bhvm.PageSize = pageSize; bhvm.HasMorePages = bhvm.RecentPosts.Count() > 0; bhvm.Controller = "post"; bhvm.Action = "PostPage"; return View("Index", bhvm); }
CategoryInfo[] IMetaWeblog.GetCategories(string blogid, string username, string password) { if (InvalidUser(username, password)) { throw new XmlRpcFaultException(INVALID_CREDENTIALS, INVALID_CREDENTIALS_MSG); } List <CategoryInfo> categoryInfos = new List <CategoryInfo>(); IQueryable <SeqCategory> cats = catRep.AllCategories(blogid); foreach (SeqCategory sc in cats) { CategoryInfo ci = new CategoryInfo(); ci.categoryid = sc.CategoryId.ToString(); ci.title = sc.Name; ci.description = "None"; ci.htmlUrl = "Not implemented"; ci.rssUrl = "Not implemented"; categoryInfos.Add(ci); } return(categoryInfos.ToArray()); }
public ActionResult PostsForTag(int tagId, string bid, int pageNum, string order) { TagHomeVModel thvm = GetPostsForTag(tagId, bid, pageNum, order); if (thvm == null) { return(View("NoTagsFound")); } thvm.Action = "PostsForTag"; thvm.AllCategories = VModelFactory.AllCategories( catRep.AllCategories(bid), bid); return(View("PostsForTag", thvm)); }
private PostsForCategoryVModel GetPostsForCategory(string bid, string category, string order, int pageNum=1) { if (bid == null) bid = blogId; IQueryable<SeqPost> catPosts = postsRep.PostsForCategory( bid, category, order, pageSize, pageNum); PostsForCategoryVModel pcvm = new PostsForCategoryVModel(category); pcvm.BlogId = bid; pcvm.Controller = "Category"; pcvm.AllPosts = VModelFactory.BlogPosts(catPosts); pcvm.CurrentPage = pageNum; pcvm.PageSize = pageSize; pcvm.HasMorePages = pcvm.AllPosts.Count() > 0; pcvm.AllCategories = VModelFactory.AllCategories( catRep.AllCategories(bid),bid); //pcvm.News = VModelFactory.BlogPosts(catRep.RecentNews(5)); //pcvm.Books = VModelFactory.Books(bookRep.AllBooks()); return pcvm; }