Exemplo n.º 1
0
        // GET: Index
        // Display login page
        public ActionResult Index()
        {
            BankLogic ATMStatus = new BankLogic();

            // Change ATM units
            string ATMID = "A1"; // Ok
            //string ATMID = "B2"; // Out of Service
            //string ATMID = "A2"; // Low amount of currency
            //string ATMID = "C1"; // No currency

            // Set current ATM in session and check status
            Session["ATMID"] = ATMID;
            List<string> checkStatus = ATMStatus.CheckATMStatus(ATMID);

            // Show log in page or error page depending on status
            if (checkStatus[0] == "Ok")
            {
                return View();
            }
            else
            {
                return this.RedirectToAction("Error", "Bank", new { error = checkStatus[1] });
            }
        }