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