Ejemplo n.º 1
0
        public virtual T Delete(T entity)
        {
            try
            {
                if (entity != null)
                {
                    if (_dbContext.Remove(entity).State == EntityState.Deleted)
                    {
                        return(entity);
                    }
                }

                _logger.CustomLogError($"Entity not found on delete: {_entityName}");
            }
            catch (Exception ex)
            {
                _logger.CustomLogError(ex, $"Error deleting entity: {_entityName} with Id: {entity?.Id}");
            }

            return(null);
        }