Exemplo n.º 1
0
 public void Delete(Student student)
 {
     using (ETradeContext context = new ETradeContext())
     {
         var entity = context.Entry(student);
         entity.State = System.Data.Entity.EntityState.Deleted;
         context.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void Add(Student student)
 {
     using (ETradeContext context = new ETradeContext())
     {
         // context.Students.Add(student);
         var entity = context.Entry(student);
         entity.State = System.Data.Entity.EntityState.Added;
         context.SaveChanges();
     }
 }