Ejemplo n.º 1
0
        public TEntity Remove(TEntity entity)
        {
            var dbSet = _context.Set <TEntity>();

            if (_context.Entry(entity).State == EntityState.Detached)
            {
                dbSet.Attach(entity);
            }
            return(dbSet.Remove(entity));
        }
Ejemplo n.º 2
0
        public virtual TEntity Remove <TEntity>(TEntity entity) where TEntity : class, new()
        {
            var dbSet = _context.Set <TEntity>();

            if (_context.Entry(entity).State == EntityState.Detached)
            {
                dbSet.Attach(entity);
            }
            return(dbSet.Remove(entity));
        }