public static List <QuestionLookupObject> GetQuestions() { List <QuestionLookupObject> questionsList = new List <QuestionLookupObject>(); var questions = ContextManager.GetQuestions(); foreach (var question in questions) { QuestionLookupObject questionObject = new QuestionLookupObject(); questionObject.QuestionId = question.QuestionId; questionObject.QuestionName = question.QuestionName; questionObject.Category = new CategoryLookupObject { CategoryId = question.CategoryId, CategoryName = question.Category.CategoryName }; questionsList.Add(questionObject); } return(questionsList); }
public static List <QuestionLookupObject> GetQuestionsByCategoryId(int categoryId) { var questions = ContextManager.GetQuestionsByCategoryId(categoryId); List <QuestionLookupObject> questionLookupList = new List <QuestionLookupObject>(); foreach (var question in questions) { QuestionLookupObject questionLookup = new QuestionLookupObject(); questionLookup.QuestionId = question.QuestionId; questionLookup.QuestionName = question.QuestionName; questionLookup.Category = new CategoryLookupObject { CategoryId = question.CategoryId, CategoryName = question.Category.CategoryName }; questionLookupList.Add(questionLookup); } return(questionLookupList); }