public void Execute(BoundPaymentDto boundPaymentDto) { var payment = GetPayment(boundPaymentDto.PaymentId); var paymentInvoice = GetPaymentInvoice(boundPaymentDto.PaymentInvoiceId); var currentUser = this.GetCurrentUser(); var paymentUse = new PaymentUse { Payment = payment, PaymentInvoice = paymentInvoice, Request = paymentInvoice.Request, ProtectionDoc = paymentInvoice.ProtectionDoc, Contract = paymentInvoice.Contract, Amount = boundPaymentDto.Amount, Description = boundPaymentDto.Description, DateCreate = DateTimeOffset.Now, EmployeeCheckoutPaymentName = currentUser.NameRu }; payment.PaymentUseAmmountSumm = payment.PaymentUses.Sum(x => x.Amount) + paymentUse.Amount; Uow.GetRepository <Payment>().Update(paymentUse.Payment); Uow.GetRepository <PaymentUse>().Create(paymentUse); Uow.SaveChanges(); }
public IActionResult Bound([FromBody] BoundPaymentDto boundPaymentDto) { Executor.GetCommand <BoundPaymentCommand>().Process(c => c.Execute(boundPaymentDto)); return(Ok()); }