private async Task NewQuestion() { tbComments.Text = ""; Questions = await GetQuestions(); if (Questions == null) { lbNoResults.Visible = true; pnlAll.Visible = false; return; } QuestionContents = await GetQuestionContents(); QuestionData = await GetQuestionData(); if (Bundle != null) { passageText = Bundle.Get <string>("passageText"); } int idx = 1; for (int i = 0; i < Questions.Length; i++) { QuestionBlock questionBlock = (QuestionBlock)LoadControl("~/UserControls/QuestionBlock.ascx"); questionBlock.FillContents(Questions[i], QuestionContents[i], QuestionData[i], idx++); pnlQuestions.Controls.Add(questionBlock); AlreadyVisited.Add(Questions[i].ObjectId); } }
private async Task <Question[]> GetQuestions() { Question question1 = await GetQuestion(); if (question1 == null) { return(null); } if (question1.Get <bool>("inBundle")) { Bundle = question1.Get <QuestionBundle>("bundle"); await Bundle.FetchAsync(); IList <Question> questions = Bundle.Get <IList <Question> >("questions"); foreach (Question question in questions) { await question.FetchIfNeededAsync(); } return(questions.ToArray()); } else { return(new Question[1] { question1 }); } }
private async Task<Question[]> GetQuestions() { Question question1 = await GetQuestion(); if (question1 == null) return null; if (question1.Get<bool>("inBundle")) { Bundle = question1.Get<QuestionBundle>("bundle"); await Bundle.FetchAsync(); IList<Question> questions = Bundle.Get<IList<Question>>("questions"); foreach (Question question in questions) await question.FetchIfNeededAsync(); return questions.ToArray(); } else { return new Question[1] { question1 }; } }