Exemplo n.º 1
0
 public void Delete(Car entity)
 {
     using (RentcarContext context = new RentcarContext())
     {
         var deletedEntity = context.Entry(entity);
         deletedEntity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void Update(Car entity)
 {
     using (RentcarContext context = new RentcarContext())
     {
         var updatedEntity = context.Entry(entity);
         updatedEntity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void Add(Car entity)
 {
     using (RentcarContext context = new RentcarContext())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Added;
         context.SaveChanges();
     }
 }