示例#1
0
        public List <ShortInfoQuestionResponse> AddQuestionForQuiz(int questionId, int quizId)
        {
            var question = _questionRepo.GetById(questionId) ?? throw new Exception("Question not found");
            var quiz     = _quizRepo.GetById(quizId) ?? throw new Exception("Quiz not found");

            if (question.Theme == quiz.Theme)
            {
                return(_mapper
                       .Map <List <ShortInfoQuestionResponse> >(_quizRepo.AddQuestionForQuiz(questionId, quizId)));
            }
            throw new Exception("Quiz and Question have different themes");
        }