Пример #1
0
        public IActionResult Deposit(Transaction transfer)
        {
            if (ModelState.IsValid)
            {
                var response = _service.Deposit(transfer.AccountNumber, transfer.Amount);

                if (response == BankResponse.NoAccount)
                {
                    ModelState.AddModelError(nameof(Transaction.AccountNumber), "The account does not exist");
                }

                if (ModelState.IsValid)
                {
                    return(View("TransactionSuccess", _service.GetAccountBalance(transfer.AccountNumber)));
                }
            }

            return(View("Index", transfer));
        }