Пример #1
0
        public ActionResult DoingTest()
        {
            var session    = (StudentLogin)Session[CommonConstants.STUDENT_SESSION];
            var id_student = session.id_student;

            if (studentDao.getTesting(id_student) < 0)
            {
                return(View("Error"));
            }
            var id_thread     = studentDao.getTesting(id_student);
            var time_remaning = studentDao.GeTimeRemaning(id_student, id_thread);

            if (time_remaning != null)
            {
                string[] time = Regex.Split(time_remaning, ":");
                ViewBag.min = time[0];
                ViewBag.sec = time[1];
            }

            var id_exam = studentDao.GetIdExam(id_student, id_thread);

            var model = studentDao.GetListQuest(id_exam, id_student);

            if (model.Count > 0)
            {
                ViewBag.idStudent = id_student;
                ViewBag.idExam    = id_exam;
                studentDao.UpdateLastLogin(id_student, GetIPAddress(), GetUserEnvironment());
                studentDao.UpdateLastSeen("Đang làm bài " + model.FirstOrDefault().thread.thread_name, Url.Action("DoingTest"), id_student);
                ViewBag.studenname = studentDao.ViewDetail(id_student).student_name;
                return(View(model));
            }
            else
            {
                TempData["status_id"] = false;
                TempData["status"]    = "Không tìm thấy câu hỏi !!";
                return(View("DoingTest"));
            }
        }