Esempio n. 1
0
        public async Task <IActionResult> Details(int id)
        {
            HttpContext.Session.SetString("UserIsAuthorized", "false");
            User user = await CurrentUser();

            var bankAccount = service_.GetBankAccountByUserAndId(user, id);

            if (bankAccount == null)
            {
                return(NotFound());
            }
            return(View(bankAccount));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create(int id)
        {
            if (HttpContext.Session.GetString("SafeMode") == "true")
            {
                if (HttpContext.Session.GetString("UserIsAuthorized") == "false")
                {
                    HttpContext.Session.SetInt32("DetailsId", id);
                    HttpContext.Session.SetString("SafeModeAction", "TransactionCreate");
                    return(RedirectToAction("SafeMode", "BankAccounts"));
                }
            }

            BankAccount acc;
            User        user = await CurrentUser();

            if (HttpContext.Session.GetInt32("DetailsId") == null)
            {
                acc = service_.GetBankAccountByUserAndId(user, id);
            }
            else
            {
                acc = service_.GetBankAccountByUserAndId(user, (int)HttpContext.Session.GetInt32("DetailsId"));
            }

            if (acc == null)
            {
                return(NotFound());
            }

            if (acc.IsLocked)
            {
                return(NotFound());
            }

            ViewData["SourceAccountNumber"] = acc.Number;
            ViewData["SourceAccountId"]     = acc.Id;
            return(View());
        }