public async Task DeleteAsync(long id, CancellationToken cancellationToken = default(CancellationToken))
        {
            File deletingFile = await _files.FindAsync(new object[] { id }, cancellationToken) ?? throw new EntityNotFoundException(id);

            _fsContext.Remove(deletingFile);
            await _fsContext.SaveChangesAsync(cancellationToken);
        }
Beispiel #2
0
        public async Task <Response <FileEditErrors> > DeleteAsync(string fileId)
        {
            var fileEdit = await _GetByFileIdAsync(fileId);

            if (null == fileEdit)
            {
                return(new Response <FileEditErrors>(FileEditErrors.FileEditDoesNotExist));
            }
            _dbContext.Remove(fileEdit);
            await _dbContext.SaveChangesAsync();

            await _NotifyAsync(fileEdit, FileEditNotifications.Deleted);

            return(new Response <FileEditErrors>());
        }