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