public void Delete(Car entity)
 {
     using (CarRentalContext context = new CarRentalContext())
     {
         var deletedEntity = context.Entry(entity);
         deletedEntity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
 public void Update(Car entity)
 {
     using (CarRentalContext context = new CarRentalContext())
     {
         var updatedEntity = context.Entry(entity);
         updatedEntity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void Add(Car entity)
 {
     using (CarRentalContext context = new CarRentalContext())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Added;
         context.SaveChanges();
     }
 }