public async Task <IActionResult> AddSurvey(AddSurveyModel input)
        {
            await this.surveyService.AddSurveyAsync(input.Topic);

            this.TempData["Topic"] = input.Topic;
            return(this.Redirect($"/Administration/Dashboard/AddQuestionToSurvey"));
        }
Пример #2
0
        public async Task <Survey> AddSurvey([FromBody] AddSurveyModel addSurveyModel)
        {
            var survey = new Survey
            {
                Title     = addSurveyModel.Title,
                ExpiresAt = DateTime.Now.AddMinutes(addSurveyModel.Minutes.Value),
                Options   = addSurveyModel.Options.Select(o => o.OptionValue).ToList()
            };

            surveys.Add(survey);
            await hubContext.Clients.All.SurveyAdded(survey.ToSummary());

            return(survey);
        }