public async Task <bool> Handle(ChangeOrSetAmountCommand request, CancellationToken cancellationToken)
        {
            await UpdateAsync(Guid.Parse(request.Id), async payment =>
            {
                payment.ChangeOrSetAmountTo(
                    Money.Create(request.Amount.Value, request.CurrencyCode.Value)
                    );
            });

            return(await Task.FromResult(true));
        }
        public async Task <bool> Handle(ChangeOrSetAmountCommand request, CancellationToken cancellationToken)
        {
            await UpdateAsync(Guid.Parse(request.Id), async payment =>
            {
                payment.SomeNotNull()
                .Match(p => PaymentTransaction.ChangeOrSetAmountTo(p,
                                                                   Money.Create(request.Amount.Value, request.CurrencyCode.Value)
                                                                   ), () => throw new AggregateNotFoundException());
            });

            return(await Task.FromResult(true));
        }
예제 #3
0
 public Task <IActionResult> ChangeAmount([FromBody] ChangeOrSetAmountCommand request) =>
 HandleOrThrow(request, async(r) => await this._mediatr.Send(r));