public void Delete(Student student) { using (ETradeContext context = new ETradeContext()) { var entity = context.Entry(student); entity.State = System.Data.Entity.EntityState.Deleted; context.SaveChanges(); } }
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(); } }