Пример #1
0
        public ActionResult CheckPassword(FormCollection form)                                  // ktra mk bài thi
        {
            if (!user.IsStudent())
            {
                return(View("Error"));
            }
            if (user.IsTesting())
            {
                return(RedirectToAction("DoingTest"));                                           // trả về view làm bài thi
            }
            string test_code     = form["test_code"];
            int    code          = Convert.ToInt32(test_code);
            string password      = Encryptor.MD5Hash(form["password"]);
            string test_password = Model.GetTest(code).password;

            if (!password.Equals(test_password))                                                // ktra mật khẩu
            {
                TempData["status_id"] = false;
                TempData["status"]    = "Mật khẩu không đúng!";
                return(RedirectToAction("Index"));
            }
            else
            {
                Model.CreateStudentQuestion(code);
                Model.UpdateStatus(code, Model.GetTest(code).time_to_do + ":00");
                return(RedirectToAction("DoingTest"));
            }
        }