public Task <CephFileId> Save(FileWithMetadata fileWithMetadata) { var rawGuid = Guid.NewGuid(); var fileId = new CephFileId(rawGuid); _files.Add(fileId, fileWithMetadata); return(Task.FromResult(fileId)); }
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)); }
public FileWithMetadata( Guid fileId, string filename, string contentType, IReadOnlyCollection <string> tags, DateTimeOffset?createdAt, byte[] fileContent) { CephFileId = new CephFileId(fileId); Filename = filename; ContentType = contentType; Tags = tags; CreatedAt = createdAt; FileContent = new ReadOnlyCollection <byte>(fileContent); }
public PaperWaybill( WaybillId id, CephFileId sourceFileId, OrderId orderId, WaybillContent content, WaybillContentStructuralValidationResult structuralValidationResult, WaybillInteractionState interactionState) : base( id, orderId, content) { SourceFileId = sourceFileId; StructuralValidationResult = structuralValidationResult; InteractionState = interactionState; }
public static PaperWaybill MapToPaperWaybill(this WaybillDto waybillDto) { if (waybillDto == null) { throw new ArgumentNullException(nameof(waybillDto)); } var id = new WaybillId(waybillDto.Id); var fileId = new CephFileId(waybillDto.File.CephId); var orderId = new OrderId(waybillDto.OrderId); var waybillContent = waybillDto.Content?.MapToModel(); var structuralValidationResult = waybillDto.ValidationResult?.MapToModel(); var interactionState = waybillDto.InteractionState.MapToModel(); return(new PaperWaybill( id: id, sourceFileId: fileId, orderId: orderId, content: waybillContent, structuralValidationResult: structuralValidationResult, interactionState: interactionState)); }
public WaybillFileWithId(CephFileId cephFileId, File file, DateTimeOffset uploadTime) : base(file, uploadTime) { Id = cephFileId; }
public PaperWaybill(OrderId orderId, CephFileId sourceFileId) : base(orderId) { SourceFileId = sourceFileId; }
public Task <FileWithMetadata> Get(CephFileId cephFileId) { var file = _files[cephFileId]; return(Task.FromResult(file)); }