Пример #1
0
 public void Delete(Product entity)
 {
     using (CarRentalDataBaseContext context = new CarRentalDataBaseContext())
     {
         var deletedEntity = context.Entry(entity);
         deletedEntity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Пример #2
0
 public void Update(Product entity)
 {
     using (CarRentalDataBaseContext context = new CarRentalDataBaseContext())
     {
         var updatedEntity = context.Entry(entity);
         updatedEntity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Пример #3
0
 public void Add(Product entity)
 {
     using (CarRentalDataBaseContext context = new CarRentalDataBaseContext())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Added;
         context.SaveChanges();
     }
 }