コード例 #1
0
        public AnswerResults IsAnswerCorrect(int answerId)
        {
            var           searchedAnswer = _quizStorage.GetAnswerById(answerId);
            AnswerResults returnResult   = new AnswerResults();

            returnResult.IsCorrect = searchedAnswer.IsCorrect;
            return(returnResult);
        }
コード例 #2
0
        public AnswerResults CorrectAnswer(int questionId, int answerId)
        {
            var           question       = _quizRepo.GetQuestionById(questionId);
            AnswerResults results        = new AnswerResults();
            var           selectedAnswer = question.Answers.First(a => a.AnswerId == answerId);

            if (selectedAnswer != null)
            {
                results.IsCorrect = selectedAnswer.IsCorrect;
            }

            return(results);
        }