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