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