示例#1
0
        public IActionResult ViewExam(ViewExamViewModel vm)
        {
            //TODO: Fix model binding issue
            var responses = vm.Responses;

            foreach (var item in responses)
            {
                var course = context.ReadResponsesByCourse(item.Key, vm.Exam.Id);

                foreach (var qr in course)
                {
                    foreach (var q in item.Value)
                    {
                        var r = context.ReadResponse(qr.Id);
                        r.Response = q.Response;
                        r.Rating   = q.Rating;
                        context.SaveResponse(r);
                    }
                }
            }


            return(RedirectToAction("ViewExam", new { id = vm.Exam.Id }));
        }