コード例 #1
0
        public async Task <Guid> Add(PaymentFormSaveDto paymentFormSaveDto)
        {
            var files = paymentFormSaveDto.Items
                        .SelectMany(i => i.Files,
                                    (p, f) => new { Item = p, FileDTO = f, File = fileBuilder.Build(f) })
                        .ToArray();

            await Task.WhenAll(files.Select(f => fileStorageService.Save(
                                                new MemoryStream(Convert.FromBase64String(f.FileDTO.FileInBase64)),
                                                f.File.WayToFile)));

            var items = paymentFormSaveDto.Items
                        .GroupJoin(files, p => p, p => p.Item,
                                   (p, pp) => paymentPositionBuilder.Build(p, pp.Select(f => f.File).ToArray()))
                        .ToArray();

            var number = await paymentFormDataService.GetNewPaymentFormNumber();

            var paymentForm      = paymentFormBuilder.Build(paymentFormSaveDto, items, number);
            var paymentFormSaved = await paymentFormDataService.Add(paymentForm);

            return(paymentFormSaved.Id);
        }
コード例 #2
0
 public async Task <Guid> Add([FromBody] PaymentFormSaveDto paymentFormSaveDto)
 {
     return(await paymentFormAppService.Add(paymentFormSaveDto));
 }