예제 #1
0
 public AccountsController(
     IMediator mediator,
     TransferPresenter presenter)
 {
     _mediator  = mediator;
     _presenter = presenter;
 }
예제 #2
0
        public async Task <IActionResult> Transfer(
            [FromServices] IMediator mediator,
            [FromServices] TransferPresenter presenter,
            [FromForm][Required] TransferRequest request)
        {
            var input = new TransferInput(
                new AccountId(request.OriginAccountId),
                new AccountId(request.DestinationAccountId),
                new PositiveMoney(request.Amount));

            await mediator.PublishAsync(input);

            return(presenter.ViewModel);
        }
        public async Task <IActionResult> Transfer(
            [FromServices] IMediator mediator,
            [FromServices] TransferPresenter presenter,
            [FromForm][Required] TransferRequest request)
        {
            var input = new TransferInput(
                request.OriginAccountId,
                request.DestinationAccountId,
                request.Amount);

            await mediator.PublishAsync(input)
            .ConfigureAwait(false);

            return(presenter.ViewModel);
        }