Example #1
0
	public ActionResult GetSinglePost(string bid, int id)
	{
		if (bid == null)
			bid = blogId;
		IQueryable<SeqPost> sp = postsRep.GetPost(id);
		BlogHomeVModel bhvm = new BlogHomeVModel();
		bhvm.BlogId = bid;
		bhvm.RecentPosts = VModelFactory.BlogPosts(sp);
		bhvm.AllCategories = VModelFactory.AllCategories(
										catRep.AllCategories(bid),bid);
		return View(bhvm);
	}
Example #2
0
	/// <summary>
	/// Fetch a page of blog posts and returns a partial view. 
	/// </summary>
	/// <param name="bid">Blog id</param>
	/// <param name="pageNum">The requested page of blog posts.</param>
	/// <returns>A partial view containing a page of blog posts.</returns>
	public ActionResult AjaxPostPage(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.CurrentPage = pageNum;
		bhvm.PageSize = pageSize;
		bhvm.HasMorePages = bhvm.RecentPosts.Count() > 0;
		bhvm.Controller = "post";
		bhvm.Action = "AjaxPostPage";
		return PartialView(bhvm);
	}