/// <summary> /// Loads the Questions for each section into the FAQ Model /// </summary> /// <param name="faq"></param> /// <param name="faqModels"></param> /// <param name="apiClient"></param> /// <param name="authInfo"></param> /// <remarks> /// Date: 24/06/2018 /// Author: Stephen McCutcheon /// </remarks> private static void LoadQuestionsIntoViewModel(FAQ faq, FaqModelView faqModels, MyServersApiClient apiClient, AuthInfo authInfo) { var sectioncounter = 0; var questionCounter = 0; //Loads in all the sections and Questions for the selected section var section = (from x in faq.Sections where x.SectionID == faqModels.SelectedSectionId select x).FirstOrDefault(); if (section != null) { var sectionModel = new FaqSectionItem { SectionId = "Section" + sectioncounter, SectionIdDataSource = "#Section" + sectioncounter, Section = section.Section, Questions = new List <FaqQuestionItem>() }; var quest1 = apiClient.GetAllQuestions(authInfo, section.SectionID); foreach (var question in quest1) { var questionModel = new FaqQuestionItem { QuestionId = "Question" + questionCounter, QuestionIdDataSource = "#Question" + questionCounter, Question = question.Question, Answer = question.Answer }; sectionModel.Questions.Add(questionModel); questionCounter = questionCounter + 1; } faqModels.SelectedSection = sectionModel; faqModels.Sections.Add(sectionModel); } }