Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created September 24, 2019 10:17
Show Gist options
  • Save ntakouris/01140b73423c223db68e74913650c85f to your computer and use it in GitHub Desktop.
Save ntakouris/01140b73423c223db68e74913650c85f to your computer and use it in GitHub Desktop.
public async Task<List<Post>> GetPostsAsync(string userId = null, PaginationFilter paginationFilter = null)
{
var queryable = _dataContext.Posts.AsQueryable();
if (paginationFilter == null)
{
return await queryable.Include(x => x.Tags).ToListAsync();
}
if (!string.IsNullOrEmpty(userId))
{
queryable = queryable.Where(x => x.UserId == userId);
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment