public ActionResult AccountInfoOperation(AccountNumberViewModel model)
 {
     if (ModelState.IsValid)
     {
         TempData["Message"]          = accountService.GetAccoutInformation(model.AccountNumber);
         TempData["OperationSuccess"] = true;
         return(RedirectToAction("AccountOperations"));
     }
     return(View());
 }
 public ActionResult CloseAccountOperation(AccountNumberViewModel model)
 {
     if (ModelState.IsValid)
     {
         accountService.CloseAccount(model.AccountNumber);
         TempData["OperationSuccess"] = true;
         TempData["Message"]          = "Account is closed!";
         return(RedirectToAction("AccountOperations"));
     }
     return(View());
 }
Пример #3
0
        public async Task <ActionResult> CloseAccountOperation(AccountNumberViewModel accountId)
        {
            if (!ModelState.IsValid)
            {
                TempData["isError"] = true;
                return(View("AccountStatusOrClose"));
            }

            try
            {
                await Task.Run(() => _accountService.CloseAccount(accountId.AccountNumber));

                TempData["isError"] = false;
                return(RedirectToAction(nameof(this.AccountOperations)));
            }
            catch (Exception e)
            {
                ModelState.AddModelError(nameof(accountId.AccountNumber), e.Message);
                TempData["isError"] = true;
                return(View("AccountStatusOrClose"));
            }
        }
Пример #4
0
        public async Task <ActionResult> GetAccountStatusOperation(AccountNumberViewModel accountId)
        {
            if (!ModelState.IsValid)
            {
                TempData["isError"] = true;
                return(View("AccountStatusOrClose"));
            }

            try
            {
                var accountInfo = await Task.Run(() => _accountService.GetAccountStatus(accountId.AccountNumber));

                TempData["isError"]     = false;
                ViewBag.IsAccountStatus = true;
                return(View(nameof(this.AccountOperations), GetAccountStatusModel(accountInfo)));
            }
            catch (Exception e)
            {
                ModelState.AddModelError(nameof(accountId.AccountNumber), e.Message);
                TempData["isError"] = true;
                return(View("AccountStatusOrClose"));
            }
        }