public T Update(T updatedEntity, object key)
        {
            if (updatedEntity == null)
            {
                return(null);
            }

            T existing = _context.Set <T>().Find(key);

            if (existing != null)
            {
                _context.Entry(existing).CurrentValues.SetValues(updatedEntity);
                _context.SaveChanges();
            }
            return(existing);
        }
Example #2
0
 public DbEntityEntry <TEntity> Entry <TEntity>(TEntity entity) where TEntity : class
 {
     return(m_DbContext.Entry(entity));
 }