public Color Get(Expression <Func <Color, bool> > filter)
 {
     using (RentACarContext context = new RentACarContext())
     {
         return(context.Set <Color>().SingleOrDefault(filter));
     }
 }
예제 #2
0
 public List <Brand> GetAll(Expression <Func <Brand, bool> > filter = null)
 {
     using (RentACarContext rentACarContext = new RentACarContext())
     {
         return(filter == null?rentACarContext.Set <Brand>().ToList() : rentACarContext.Set <Brand>().Where(filter).ToList());
     }
 }
예제 #3
0
 public Brand Get(Expression <Func <Brand, bool> > filter)
 {
     using (RentACarContext rentACarContext = new RentACarContext())
     {
         return(rentACarContext.Set <Brand>().SingleOrDefault(filter));
     }
 }
 public List <Color> GetAll(Expression <Func <Color, bool> > filter = null)
 {
     using (RentACarContext context = new RentACarContext())
     {
         return(filter == null?context.Set <Color>().ToList() :
                    context.Set <Color>().Where(filter).ToList());
     }
 }
 public void Update(Color entity)
 {
     using (RentACarContext context = new RentACarContext())
     {
         var updatedColor = context.Entry(entity);
         updatedColor.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void Delete(Color entity)
 {
     using (RentACarContext context = new RentACarContext())
     {
         var deletedColor = context.Entry(entity);
         deletedColor.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
 public void Add(Color entity)
 {
     using (RentACarContext context = new RentACarContext())
     {
         var addedColor = context.Entry(entity);
         addedColor.State = EntityState.Added;
         context.SaveChanges();
     }
 }
예제 #8
0
 public void Update(Brand entity)
 {
     using (RentACarContext rentACarContext = new RentACarContext())
     {
         var updateEntity = rentACarContext.Entry(entity);
         updateEntity.State = EntityState.Modified;
         rentACarContext.SaveChanges();
     }
 }
예제 #9
0
 public void Delete(Brand entity)
 {
     using (RentACarContext rentACarContext = new RentACarContext())
     {
         var deleteEntity = rentACarContext.Entry(entity);
         deleteEntity.State = EntityState.Deleted;
         rentACarContext.SaveChanges();
     }
 }
예제 #10
0
 public void Add(Brand entity)
 {
     using (RentACarContext rentACarContext = new RentACarContext())
     {
         var addedEntity = rentACarContext.Entry(entity);
         addedEntity.State = EntityState.Added;
         rentACarContext.SaveChanges();
     }
 }