예제 #1
0
        public ActionResult CheckPassword(FormCollection form)
        {
            var session    = (StudentLogin)Session[CommonConstants.STUDENT_SESSION];
            var id_student = session.id_student;

            if (studentDao.getTesting(id_student) > 0)
            {
                return(RedirectToAction("DoingTest"));
            }
            string code          = form["id_room"];
            int    id_room       = Convert.ToInt32(code);
            string password      = form["password"];
            string room_password = studentDao.GetPass(id_room);

            if (!password.Equals(room_password))
            {
                TempData["status_id"] = false;
                TempData["status"]    = "Mật khẩu không đúng!";
                return(RedirectToAction("Index"));
            }
            else
            {
                studentDao.ConnectStudentExam(id_room, id_student);
                studentDao.UpdateStatus(id_room, id_student, studentDao.GeTimeToDo(id_room) + ":00");
                return(RedirectToAction("DoingTest"));
            }
        }