public List <usp_GetRankedQuestions_Result> GetRankedQuestions() { int assessmentId = Auth.AssessmentForUser(); RequirementsManager rm = new RequirementsManager(assessmentId); using (CSET_Context context = new CSET_Context()) { var rankedQuestionList = context.usp_GetRankedQuestions(assessmentId).ToList(); foreach (usp_GetRankedQuestions_Result q in rankedQuestionList) { q.QuestionText = rm.ResolveParameters(q.QuestionOrRequirementID, q.AnswerID, q.QuestionText); } return(rankedQuestionList); } }
public List <RankedQuestions> GetRankedQuestions() { using (var db = new CSET_Context()) { RequirementsManager rm = new RequirementsManager(_assessmentId); List <RankedQuestions> list = new List <RankedQuestions>(); List <usp_GetRankedQuestions_Result> rankedQuestionList = db.usp_GetRankedQuestions(_assessmentId).ToList(); foreach (usp_GetRankedQuestions_Result q in rankedQuestionList) { q.QuestionText = rm.ResolveParameters(q.QuestionOrRequirementID, q.AnswerID, q.QuestionText); list.Add(new RankedQuestions() { Answer = q.AnswerText, CategoryAndNumber = q.Category + " #" + q.QuestionRef, Level = q.Level, Question = q.QuestionText, Rank = q.Rank ?? 0 }); } return(list); } }