Engage.Survey.Entities.SurveyRepository.LoadReadOnlyAnswers C# (CSharp) Method

LoadReadOnlyAnswers() public method

Loads the completed answers for a given completed question.
public LoadReadOnlyAnswers ( int responseHeaderId, int questionId ) : IQueryable
responseHeaderId int The ID of the of the completed survey.
questionId int The ID of the question.
return IQueryable
        public IQueryable<ReadonlyAnswer> LoadReadOnlyAnswers(int responseHeaderId, int questionId)
        {
            return (from response in this.Context.Responses
                    where response.ResponseHeaderId == responseHeaderId && response.QuestionId == questionId
                    select new ReadonlyAnswer
                               {
                                   AnswerId = response.AnswerId ?? 0,
                                   Text = response.AnswerText,
                                   RelativeOrder = response.AnswerRelativeOrder ?? 0,
                                   IsCorrect = response.AnswerIsCorrect ?? false,
                                   SectionId = response.SectionId,
                                   QuestionId = response.QuestionId,
                                   ResponseHeaderId = response.ResponseHeaderId,
                                   AnswerValue = response.UserResponse
                               })
                    .Distinct()
                    .OrderBy(response => response.RelativeOrder);
        }