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); }
public string GetAnswers(Question question) { return(string.Join(",", Answers.Where(a => a.QuestionId == question.QuestionId).Select(b => b.AnswerText))); }