BgEngine.Controllers.ApiController.GetPostsBy C# (CSharp) Method

GetPostsBy() public method

public GetPostsBy ( string by, string id, int page ) : JsonpResult
by string
id string
page int
return JsonpResult
        public JsonpResult GetPostsBy(string by, string id, int? page)
        {
            var pageIndex = page ?? 0;
            IEnumerable<Post> source;
            if (by == "category")
            {
                source = BlogServices.FindPagedPostsByCategory(false, id, pageIndex, 10).Where(p => p.IsPublic && p.IsAboutMe == false);
            }
            else
            {
                source = BlogServices.FindPagedPostsByTag(false, id, pageIndex, 10).Where(p => p.IsPublic && p.IsAboutMe == false);
            }
            var data = new
            {
                posts =
                    from p in source
                    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);
        }