コード例 #1
0
        public string MakePayment(int registrationId, double amount)
        {
            Student student   = (Student)Session["student"];
            int     studentId = student.StudentId;

            if (dao.ReceivePayment(studentId, registrationId, amount))
            {
                student            = dao.FindStudentById(studentId);
                Session["student"] = student;
                return("Thank you for your payment.");
            }
            else
            {
                return("A problem occurred while processing payment.");
            }
        }
コード例 #2
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"));
        }