public void Update(T entity) { using (VETEntities entities = new VETEntities()) { entities.Entry(entity).State = EntityState.Modified; entities.SaveChanges(); } }
public void Delete(T entity) { using (VETEntities entities = new VETEntities()) { entities.Entry(entity).State = EntityState.Deleted; entities.SaveChanges(); } }
public void Insert(T entity) { using (VETEntities entities = new VETEntities()) { entities.Set <T>().Add(entity); //entities.Entry(entity).State = EntityState.Added; try { entities.SaveChanges(); } catch (DbEntityValidationException ex) { MessageBox.Show("ValidatoinExceptionTest"); throw; } } }