/// <summary> /// Получить список файлов. /// </summary> /// <returns>Перечень DTO-объектов с описанием файла.</returns> public IEnumerable<FileDisplayingDto> GetFileList() { var mapper = new FileToDisplayingDtoMapper(); IList<FileDisplayingDto> fileDtoList = _repository .GetAll() .Select(f => mapper.Map(f)) .ToList(); return fileDtoList; }
/// <summary> /// Получить список файлов. /// </summary> /// <param name="fileType">Тип файлов</param> /// <returns>Перечень DTO-объектов с описанием файла.</returns> public IEnumerable<FileDisplayingDto> GetFileList(UploadedFileTypes fileType) { var mapper = new FileToDisplayingDtoMapper(); IList<FileDisplayingDto> fileDtoList = _repository .GetList(f => f.FileType == fileType) .Select(f => mapper.Map(f)) .ToList(); return fileDtoList; }
/// <summary> /// Получить описание файла по идентификатору. /// </summary> /// <param name="id">Идентификатор</param> /// <returns>DTO-объект с описанием файла.</returns> public FileDisplayingDto GetFileById(int id) { var uploadedFile = _repository.GetOneById(id); if (uploadedFile != null) { var mapper = new FileToDisplayingDtoMapper(); return mapper.Map(uploadedFile); } return null; }