Example #1
0
 public void Delete(Car entity)
 {
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Example #2
0
 public void Update(Brand entity)
 {
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Example #3
0
 public void Add(Car entity)
 {
     // IDisposable pattern implementation of c#
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Added;
         context.SaveChanges();
     }
 }