public async Task <WaybillFile> Get(CephFileId cephFileId) { var file = await _fileRepository.Get(cephFileId); var waybillFileDto = await _context.WaybillFiles.SingleOrDefaultAsync( x => x.CephId == cephFileId.ToGuid()); var excelFile = _excelFileFactory.Create( waybillFileDto.Name, new MemoryStream(file.FileContent.ToArray())); return(new WaybillFileWithId(cephFileId, excelFile, waybillFileDto.UploadTime)); }
private List <File> CreateExcelFiles(IFormFileCollection files) { var excelFiles = new List <File>(); foreach (var file in files) { using (var stream = file.OpenReadStream()) { var excelFile = _excelFileFactory.Create(file.FileName, stream); excelFiles.Add(excelFile); } } return(excelFiles); }