public async Task <IHttpActionResult> TransferFund(int accountId, string operation, double amount) { OutAccount outAcc = null; try { var currentUser = await GetCurrentUser(); var accBll = new AccountBLL(_unit); var accBalance = new AccountBalanceBLL(_unit).GetAccountBalanceByAccount(accountId); if (operation.Equals("Withdraw", StringComparison.InvariantCultureIgnoreCase)) { if (accBalance != null && accBalance.AvailableFund < amount) { return(BadRequest("Insufficient fund.")); } } outAcc = accBll.TransferFund(accountId, operation, amount); } catch (Exception ex) { LogHelper.Error(_log, ex.ToString()); return(InternalServerError(ex)); } return(Ok(outAcc)); }
public void Test_CheckAccountBalance() { AccountBalanceBLL bll = new AccountBalanceBLL(_unit); //bool result = bll.CheckAccountBalance(1051); //Assert.IsTrue(result); }