Beispiel #1
0
 public Color Get(Expression <Func <Color, bool> > filter)
 {
     using (RecapProjectContext context = new RecapProjectContext())
     {
         return(context.Set <Color>().Where(filter).FirstOrDefault());
     }
 }
Beispiel #2
0
 public IEnumerable <Color> GetAll(Expression <Func <Color, bool> > filter = null)
 {
     using (RecapProjectContext context = new RecapProjectContext())
     {
         return(filter == null?context.Set <Color>().ToList() : context.Set <Color>().Where(filter).ToList());
     }
 }
Beispiel #3
0
 public IEnumerable <Car> GetAllByColorId(Expression <Func <Car, bool> > filter)
 {
     using (RecapProjectContext context = new RecapProjectContext())
     {
         return(context.Set <Car>().Where(filter).ToList());
     }
 }
Beispiel #4
0
 public void Delete(Color entity)
 {
     using (RecapProjectContext context = new RecapProjectContext())
     {
         context.Entry(entity).State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Beispiel #5
0
 public void Update(Brand entity)
 {
     using (RecapProjectContext context = new RecapProjectContext())
     {
         context.Entry(entity).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Beispiel #6
0
 public void Add(Car entity)
 {
     using (RecapProjectContext context = new RecapProjectContext())
     {
         context.Entry(entity).State = EntityState.Added;
         context.SaveChanges();
     }
 }