Beispiel #1
0
        public async Task <FileHistoryDTO> GetByIdAsync(string id)
        {
            var fileHistory = await _fileHistoryRepository.GetByIdAsync(id);

            if (fileHistory == null)
            {
                _logger.LogWarning(LoggingEvents.HaveException, $"Not found file history");
                throw new NotFoundException(nameof(FileHistory), id);
            }

            return(_mapper.Map <FileHistoryDTO>(fileHistory));
        }
Beispiel #2
0
        public async Task <ICollection <FileHistoryDTO> > GetAllForFileAsync(string fileId)
        {
            var file = await _fileRepository.GetByIdAsync(fileId);

            if (file == null)
            {
                _logger.LogWarning(LoggingEvents.HaveException, $"Not found file");
                throw new NotFoundException(nameof(File), fileId);
            }

            var fileHistoriesForFile = await _fileHistoryRepository.GetAllAsync(fh => fh.FileId == file.Id);

            return(_mapper.Map <ICollection <FileHistoryDTO> >(fileHistoriesForFile));
        }