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