public JsonpResult GetPosts(int? page)
{
var pageIndex = page ?? 0;
IEnumerable<Post> source = this.PostServices.RetrievePaged(pageIndex, 10, p => p.DateCreated, false);
var sourceresponse = source.Where(p => p.IsPublic && p.IsAboutMe == false);
var data = new
{
posts =
from p in sourceresponse
select new
{
postid = p.PostId,
title = p.Title,
description = p.Description,
commentscount = p.Comments.Count<Comment>(),
date = p.DateCreated.ToShortDateString(),
category = p.Category.Name,
thumbnailpath = getImageUrl(p.Image),
user = p.User.Username
},
pendingposts = source.Count() == 10 ? true : false
};
return this.Jsonp(data);
}