Esempio n. 1
0
 public void Update(T entity)
 {
     using (VETEntities entities = new VETEntities())
     {
         entities.Entry(entity).State = EntityState.Modified;
         entities.SaveChanges();
     }
 }
Esempio n. 2
0
 public void Delete(T entity)
 {
     using (VETEntities entities = new VETEntities())
     {
         entities.Entry(entity).State = EntityState.Deleted;
         entities.SaveChanges();
     }
 }
Esempio n. 3
0
        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;
                }
            }
        }