示例#1
0
 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());
     }
 }
示例#2
0
 public Color Get(Expression <Func <Color, bool> > filter)
 {
     using (CarRentalProjectContext context = new CarRentalProjectContext())
     {
         return(context.Set <Color>().SingleOrDefault(filter));
     }
 }