Exemple #1
0
 public List <Car> GetAll(Expression <Func <Car, bool> > filter = null)
 {
     using (SqlDbContext context = new SqlDbContext())
     {
         return(filter == null
             ? context.Set <Car>().ToList()
             : context.Set <Car>().Where(filter).ToList());
     }
 }
Exemple #2
0
 public Car Get(Expression <Func <Car, bool> > filter)
 {
     using (SqlDbContext context = new SqlDbContext())
     {
         return(context.Set <Car>().FirstOrDefault(filter));
     }
 }