Skip to content

Instantly share code, notes, and snippets.

@RyanABailey
Created March 14, 2016 23:52
Show Gist options
  • Save RyanABailey/1c0cf91cad088e1e5c96 to your computer and use it in GitHub Desktop.
Save RyanABailey/1c0cf91cad088e1e5c96 to your computer and use it in GitHub Desktop.
Search facet
private static Expression<Func<SearchModel, bool>> GetCategoryFacetPredicate(List<string> categories)
{
var predicate = PredicateBuilder.True<SearchModel>(); // Items which meet the predicate
foreach (var category in categories)
{
predicate = predicate.Or(x => x.Category == category);
}
return predicate;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment