예제 #1
0
 public async void CreateTransfer(ChangeBalanceTransaction transaction)
 {
     // create command
     var command = new CreateTransferCommand()
     {
         Amount = transaction.Amount, FromAccount = transaction.FromAccount, ToAccount = transaction.ToAccount
     };
     // publish it to the event bus
     await _bus.SendCommand(command); // ? if i didnt use an await we can have an error in dif thred and it will not be displayed
 }
예제 #2
0
        public IActionResult CreateTransaction([FromBody] ChangeBalanceTransaction transaction)
        {
            _logger.LogInformation($"Transaction received");

            // send command to create transfer

            _accountService.CreateTransfer(new ChangeBalanceTransaction {
                Amount = transaction.Amount, FromAccount = transaction.FromAccount, ToAccount = transaction.ToAccount
            });

            return(Ok(null));
        }