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