Esempio n. 1
0
 public List <Car> GetAll(Expression <Func <Car, bool> > filter = null)
 {
     using (RentContext context = new RentContext())
     {
         return(filter == null?context.Set <Car>().ToList() : context.Set <Car>().Where(filter).ToList());
     }
 }
Esempio n. 2
0
 public Car GetById(Expression <Func <Car, bool> > filter)
 {
     using (RentContext context = new RentContext())
     {
         return(context.Set <Car>().SingleOrDefault(filter));
     }
 }