Exemple #1
0
 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());
     }
 }
Exemple #2
0
 public Product Get(Expression <Func <Product, bool> > filter)
 {
     using (NortwindContext context = new NortwindContext())
     {
         return(context.Set <Product>().SingleOrDefault(filter));
     }
 }
Exemple #3
0
 public IEnumerable <Product> GetAllProducts()
 {
     return(_dbContext.Set <Product>());
 }
Exemple #4
0
 public IEnumerable <Category> GetAllCategories()
 {
     return(_dbContext.Set <Category>());
 }