예제 #1
0
    protected void btnTransfer_Click(object sender, EventArgs e)
    {
        ApplicationBankAccountService service = new ApplicationBankAccountService();

        TransferRequest request = new TransferRequest();
        request.AccountIdFrom = new Guid(ddlBankAccounts.SelectedValue.ToString());
        request.AccountIdTo = new Guid(ddlBankAccountsToTransferTo.SelectedValue.ToString());
        request.Amount = Decimal.Parse(txtAmountToTransfer.Text);

        service.Transfer(request);

        DisplaySelectedAccount();
    }
 public TransferResponse Transfer(TransferRequest request)
 {
     TransferResponse response = new TransferResponse();
     try
     {
         _bankAccountService.Transfer(request.AccountIdTo,
         request.AccountIdFrom, request.Amount);
         response.Success = true;
     }
     catch (InsufficientFundsException)
     {
         response.Message = "There is not enough funds in account no: " +
         request.AccountIdFrom.ToString();
         response.Success = false;
     }
     return response;
 }