Пример #1
0
 public void Delete(Car entity)
 {
     using (CarRentalDBContext context = new CarRentalDBContext())
     {
         var deletedCar = context.Entry(entity);
         deletedCar.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Пример #2
0
 public void Update(Car entity)
 {
     using (CarRentalDBContext context = new CarRentalDBContext())
     {
         var updatedCar = context.Entry(entity);
         updatedCar.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Пример #3
0
 public void Add(Car entity)
 {
     using (CarRentalDBContext context = new CarRentalDBContext())
     {
         var addedCar = context.Entry(entity);
         addedCar.State = EntityState.Added;
         context.SaveChanges();
     }
 }