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()); } }
public Car GetById(Expression <Func <Car, bool> > filter) { using (RentContext context = new RentContext()) { return(context.Set <Car>().SingleOrDefault(filter)); } }