Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created September 24, 2019 10:29
Show Gist options
  • Save ntakouris/a6ab4bfcd3897f10151d2a6a2a18d2c1 to your computer and use it in GitHub Desktop.
Save ntakouris/a6ab4bfcd3897f10151d2a6a2a18d2c1 to your computer and use it in GitHub Desktop.
private static IQueryable<Post> AddFiltersOnQuery(GetAllPostsFilter filter, IQueryable<Post> queryable)
{
if (!string.IsNullOrEmpty(filter?.UserId))
{
queryable = queryable.Where(x => x.UserId == filter.UserId);
}
// Add other filtering logic here
return queryable;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment