Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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);
        }