Esempio n. 1
0
        public async Task <ActionResult> AddQuizQuestions(AddQuizQuestionsViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                foreach (var question in viewModel.Questions)
                {
                    var answerContents = question.Answers.Select(x => x.Content).ToList();
                    var result         = await TriviaService.AddQuestionToQuizAsync(
                        viewModel.QuizId,
                        question.Content,
                        question.Points,
                        answerContents.AsReadOnly(),
                        question.CorrectAnswer,
                        question.SelectedTags.AsReadOnly());
                }
            }

            viewModel.Tags = await GetSearchableTagsAsync();

            return(View(viewModel));
        }