コード例 #1
0
        public async Task <IActionResult> Withdraw([FromBody] WithdrawRequest message)
        {
            var request = new WithdrawInput(message.AccountId, message.Amount);

            await withdrawInput.Process(request);

            return(withdrawPresenter.ViewModel);
        }
コード例 #2
0
        public async Task <IActionResult> Withdraw([FromBody] WithdrawRequest request)
        {
            var command = new WithdrawCommand(
                request.AccountId,
                request.Amount);

            WithdrawResult depositResult = await withdrawService.Process(command);

            if (depositResult == null)
            {
                return(new NoContentResult());
            }

            Model model = new Model(
                depositResult.Transaction.Amount,
                depositResult.Transaction.Description,
                depositResult.Transaction.TransactionDate,
                depositResult.UpdatedBalance
                );

            return(new ObjectResult(model));
        }