示例#1
0
 public void Delete(Car entity)
 {
     using (ReCapContext context = new ReCapContext())
     {
         var deletedEntity = context.Entry(entity);
         deletedEntity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
示例#2
0
 public void UpDate(Car entity)
 {
     using (ReCapContext context = new ReCapContext())
     {
         var updatedEntity = context.Entry(entity);
         updatedEntity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#3
0
 public void Add(Car entity)
 {
     using (ReCapContext context = new ReCapContext())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Added;
         context.SaveChanges();
     }
 }