public List <Color> GetAll(Expression <Func <Color, bool> > filter = null) { using (CarRentalProjectContext context = new CarRentalProjectContext()) { return(filter == null?context.Set <Color>().ToList() : context.Set <Color>().Where(filter).ToList()); } }
public Color Get(Expression <Func <Color, bool> > filter) { using (CarRentalProjectContext context = new CarRentalProjectContext()) { return(context.Set <Color>().SingleOrDefault(filter)); } }