Esempio n. 1
0
        public IActionResult Index(int examId)
        {
            List <ExamQuestion> examQuestions = examQuestionRepository.GetExamQuestions(examId);

            //List<QuestionChoice> questionChoices =questionChoiceRepository.GetQuestionChoices()
            ViewBag.Exam   = examRepository.Get(examId);
            ViewBag.ExamId = examId;
            return(View(examQuestions));
        }
Esempio n. 2
0
        public IActionResult TakeExam(int examID)
        {
            TakeExamViewModel takeExam = new TakeExamViewModel();
            var Exam = examRepository.Get(examID);
            List <ExamQuestion> examQuestions = examQuestionRepository.GetExamQuestions(examID).ToList();

            takeExam.Questions = examQuestions.Select(c => c.Question).ToList();

            if (takeExam.Questions.Count == 0)
            {
                return(RedirectToAction("NotExistExam"));
            }
            takeExam.ExamId       = examID;
            takeExam.ExamDuration = Exam.Duration;
            int startDateCompare = DateTime.Compare(Exam.StartDate, DateTime.Now);
            int endDateCompare   = DateTime.Compare(Exam.EndDate, DateTime.Now);

            //if (startDateCompare < 0 && endDateCompare > 0)
            //{
            // return RedirectToAction("NotExistExam");
            // }
            return(View(takeExam));
        }