public ActionResult Transfer(TransferViewModel transfer) { try { var balance = _repo.GetBalace(transfer.CheckingAccountId); if (balance < transfer.Amount) { ModelState.AddModelError("Amount", "You have insufficient funds!"); } // check for a valid destination account if (!_repo.AccountExists(transfer.DestinationCheckingAccountId)) { ModelState.AddModelError("DestinationCheckingAccountId", "Invalid destination account number."); } // add debit/credit transactions and update account balances if (ModelState.IsValid) { if (_repo.Transfer(transfer.CheckingAccountId, transfer.DestinationCheckingAccountId, transfer.Amount, transfer.Message)) { return(PartialView("_TransferSuccess", transfer)); } var error = new TransactionError { Title = "Transaction Denied", Message = "Could not transfer successfuly" }; return(View("TransactionError", error)); } return(PartialView("_TransferForm")); } catch (Exception e) { var error2 = new TransactionError { Title = "Transaction Denied", Message = e.Message }; return(View("TransactionError", error2)); } }