Created
May 8, 2019 14:11
-
-
Save hartviglarsen/e8aeead2147c34cdc10744deb531d170 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public PagedResult<BlogPost> GetPagedPostsForDisplay(int page, int max, int featured) | |
{ | |
var results = _blogSearcher.CreateQuery() | |
.NodeTypeAlias(BlogPost.ModelTypeAlias) | |
.Not() | |
.Id(featured) | |
.Not() | |
.Field(Constants.Properties.Hidden, "1") | |
.OrderByDescending(new SortableField(Constants.Examine.PublishedAt)) | |
.Execute(Paging.Max(page, max)); | |
return new PagedResult<BlogPost>(results.TotalItemCount, page, max) | |
{ | |
Items = results.Skip(Paging.Skip(page, max)).Select(x => (BlogPost)_umbraco.Content(x.Id)) | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment