示例#1
0
        public async Task <Quiz> GetQuizAsync(QuizMetadata quizMetadata)
        {
            var quizHtml = await _scraperHttpService.GetQuizPageContentAsync(quizMetadata.Id);

            var questions = _htmlService.FindQuestions(quizHtml);

            return(new Quiz
            {
                Id = quizMetadata.Id,
                Date = quizMetadata.Date,
                Title = quizMetadata.Title,
                Questions = questions
            });
        }
示例#2
0
        public async Task <Quiz> GetQuizAsync(string id = null)
        {
            QuizMetadata quizMetadata;

            if (id == null)
            {
                var quizMetadataList = await _quizMetadataService.GetQuizMetadataAsync(1);

                quizMetadata = quizMetadataList.First();
            }
            else
            {
                quizMetadata = new QuizMetadata
                {
                    Id   = id,
                    Date = DateTime.UtcNow
                };
            }

            return(await GetQuizAsync(quizMetadata));
        }