示例#1
0
        public bool CheckAnswer(Question question, string answer)
        {
            bool          isCorrect = false;
            List <string> answers   = Answers.Where(a => a.QuestionId == question.QuestionId).Select(b => b.AnswerText).ToList();

            if (answers.Any(a => a.IndexOf(answer, StringComparison.OrdinalIgnoreCase) >= 0))
            {
                isCorrect = true;
            }

            return(isCorrect);
        }
示例#2
0
 public string GetAnswers(Question question)
 {
     return(string.Join(",", Answers.Where(a => a.QuestionId == question.QuestionId).Select(b => b.AnswerText)));
 }