public IQueriable <T> CondWhere <T>(this IQueriable <T> query, bool condition, Expression <Func <T, bool> > predicate) { if (condition) { return(query.Where(predicate)); } else { return(query); } }
public IQueriable <Product> FreshOnly(this IQueriable <Product> query) { return(query.Where(x => x.PackTime >= DateTime.Now.AddDays(-1))); }
public IQueriable <Product> SelectVegetables(this IQueriable <Product> query) { return(query.Where(x => x.Type == "Vegetable")); }