public List <Product> GetAll(Expression <Func <Product, bool> > filter = null) { using (NortwindContext context = new NortwindContext()) { return(filter == null?context.Set <Product>().ToList() : context.Set <Product>().Where(filter).ToList()); } }
public List <Product> GetAll(Expression <Func <Product, bool> > filter = null) { using (NortwindContext context = new NortwindContext()) { return(filter == null ? context.Set <Product>().ToList() : context.Set <Product>().Where(filter).ToList()); //null sa Select * from products gibi değilse filtreye göre getir } }
public Product Get(Expression <Func <Product, bool> > filter) { using (NortwindContext context = new NortwindContext()) { return(context.Set <Product>().SingleOrDefault(filter)); } }