Example #1
0
 public void Delete(Car entity)
 {
     using (RentContext context = new RentContext())
     {
         var deletedContext = context.Entry(entity);
         deletedContext.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Example #2
0
 public void Update(Car entity)
 {
     using (RentContext context = new RentContext())
     {
         var updatedContext = context.Entry(entity);
         updatedContext.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Example #3
0
 public void Add(Car entity)
 {
     using (RentContext context = new RentContext())
     {
         var addedContext = context.Entry(entity);
         addedContext.State = EntityState.Added;
         context.SaveChanges();
     }
 }