Beispiel #1
0
        public ActionResult Login(string UserNum, string UserPassword)
        {
            Tuple <int, bool> u = dao.FindUserByLogin(UserNum, UserPassword);

            if (u != null)
            {
                if (u.Item2)
                {
                    // is student
                    Student student = dao.FindStudentById(u.Item1);
                    if (student != null)
                    {
                        Session["student"] = student;
                    }
                }
                else
                {
                    // is staff
                    return(RedirectToAction("Index", "Staff"));
                }
            }

            return(RedirectToAction("Index", "Home"));
        }