Beispiel #1
0
 public List <Car> GetAll(Expression <Func <Car, bool> > filter = null)
 {
     using (RentalContext context = new RentalContext())
     {
         if (filter == null)
         {
             return(context.Set <Car>().ToList());
         }
         else
         {
             return(context.Set <Car>().Where(filter).ToList());
         }
     }
 }
Beispiel #2
0
 public Car Get(Expression <Func <Car, bool> > filter)
 {
     using (RentalContext context = new RentalContext())
     {
         return(context.Set <Car>().SingleOrDefault(filter));
     }
 }