コード例 #1
0
        // Returns a list of all departments
        public ActionResult Department()
        {
            // Null handling
            if (Session["loggedInState"] == null)
            {
                Redirect("403.html");
            }

            // If logged in
            bool state = (bool)Session["loggedInState"];

            if (state == true)
            {
                // Acquires complete department list
                var dm = new DepartmentModel();
                var dl = dm.GetDepartmentsList();

                // Return list of departments
                return(View(dl));
            }
            else
            {
                // If not logged in
                return(Redirect("/login.html"));
            }
        }