Пример #1
0
        public IActionResult AddQuestion(AddQuestionViewModel model)
        {
            //var findTest = testRepository.FindTest(testId);
            //if (findTest == null)
            //{
            //    return View("NotFound");
            //}

            if (ModelState.IsValid)
            {
                QuestionAndAnswer questionAndAnswer = new QuestionAndAnswer
                {
                    Id            = Guid.NewGuid(),
                    Question      = model.Question,
                    Answer        = model.Answer,
                    Option1       = model.Option1,
                    Option2       = model.Option2,
                    Option3       = model.Option3,
                    AssignedScore = model.AssignedScore,
                    TestId        = model.TestId
                };

                testRepository.AddQuestions(questionAndAnswer);

                return(RedirectToAction("dashboard", "examiner"));
            }
            return(View(model));
        }