예제 #1
0
 public List <CarBrand> GetAll(Expression <Func <CarBrand, bool> > filter = null)
 {
     using (carcontext context = new carcontext())
     {
         return(filter == null?context.Set <CarBrand>().ToList() : context.Set <CarBrand>().Where(filter).ToList());
     }
 }
예제 #2
0
 public CarBrand Get(Expression <Func <CarBrand, bool> > filter)
 {
     using (carcontext context = new carcontext())
     {
         return(context.Set <CarBrand>().SingleOrDefault(filter));
     }
 }
예제 #3
0
 public void Delete(CarColor entity)
 {
     using (carcontext context = new carcontext())
     {
         var addedColor = context.Entry(entity);
         addedColor.State = EntityState.Deleted;
     }
 }
예제 #4
0
 public void Update(CarBrand entity)
 {
     using (carcontext context = new carcontext())
     {
         var updatedBrand = context.Entry(entity);
         updatedBrand.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
예제 #5
0
 public void Delete(CarBrand entity)
 {
     using (carcontext context = new carcontext())
     {
         var deletedbrand = context.Entry(entity);
         deletedbrand.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
예제 #6
0
 public void Add(CarBrand entity)
 {
     using (carcontext context = new carcontext())
     {
         var addedbrand = context.Entry(entity);
         addedbrand.State = EntityState.Added;
         context.SaveChanges();
     }
 }
예제 #7
0
 public void Add(CarColor entity)
 {
     using (carcontext context = new carcontext())
     {
         var addedColor = context.Entry(entity);
         addedColor.State = EntityState.Added;
         context.SaveChanges();
     }
 }