Пример #1
0
        public async Task <bool> RemoveAsync(long id)
        {
            TModel model = await GetByIdAsync(id);

            if (model == null)
            {
                return(false);
            }

            return(_context.Remove(model) != null);
        }
Пример #2
0
        /// <inheritdoc />
        public virtual async Task <bool> DeleteAsync(TModelType id)
        {
            TModel model = await GetByIdAsync(id);

            if (model == null)
            {
                //_logger.LogInformation($"delete: {id} does not exists");
                throw new KeyNotFoundException();
            }

            var result = _context.Remove(model) != null;

            //_logger.LogInformation($"removed: {id}");

            return(result);
        }