Ejemplo n.º 1
0
        protected override async Task OnInitializedAsync()
        {
            var simpleQuizzes = await SimpleQuizData.GetSectionQuizzes(Section.Id);

            var matchQuizzes = await MatchQuizData.GetSectionQuizzes(Section.Id);

            var videos = await VideoData.GetSectionVideos(Section.Id);

            blocks = new List <IContentBlock>();

            if (simpleQuizzes is not null)
            {
                foreach (var quiz in simpleQuizzes)
                {
                    quiz.DisplayTitle = quiz.Question;
                    quiz.Options      = await SimpleQuizData.GetQuizOptions(quiz.Id);
                }

                blocks.AddRange(simpleQuizzes);
            }

            if (matchQuizzes is not null)
            {
                foreach (var quiz in matchQuizzes)
                {
                    quiz.DisplayTitle = quiz.Question;
                    quiz.Options      = await MatchQuizData.GetQuizOptions(quiz.Id);
                }

                blocks.AddRange(matchQuizzes);
            }

            if (videos is not null)
            {
                foreach (var video in videos)
                {
                    video.DisplayTitle = video.Title;
                }

                blocks.AddRange(videos);
            }
        }