Exemplo n.º 1
0
 public void Delete(Car entity)
 {
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void Update(Brand entity)
 {
     using (ReCapProjectContext context = new ReCapProjectContext())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Exemplo n.º 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();
     }
 }