Exemplo n.º 1
0
        /// <summary>
        /// IAction method for returning a view of an exam
        /// </summary>
        /// <param name="id">Id for a exam</param>
        /// <returns></returns>
        public IActionResult ViewExam(int id)
        {
            var exam = context.ReadExam(id);
            var vm   = new ViewExamViewModel()
            {
                Exam = exam
            };

            var responses = new Dictionary <int, List <QuestionResponse> >();

            foreach (var item in exam.Student.StudentCourses)
            {
                responses.Add(item.Course.Id, context.ReadResponsesByCourse(item.Course.Id, exam.Id));
            }

            vm.Responses = responses;

            return(View(vm));
        }