예제 #1
0
 public void Update(T entity)
 {
     try
     {
         if (entity == null)
         {
             throw new ArgumentNullException("entity");
         }
         _Context.Entry(entity).State = EntityState.Modified;
         _Context.SaveChanges();
     }
     catch (DbEntityValidationException ex)
     {
         throw ex;
     }
 }
예제 #2
0
        public void Update(IEnumerable <T> entities)
        {
            try
            {
                if (entities == null)
                {
                    throw new ArgumentNullException("entity");
                }

                foreach (var e in entities)
                {
                    _context.Entry(e).State = EntityState.Modified;
                }

                _context.SaveChanges();
            }
            catch (DbEntityValidationException ex)
            {
                throw ex;
            }
        }