示例#1
0
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            if (Survey.SurveyName == null)
            {
                return(NotFound());
            }

            await _databaseLogic.CreateSurvey(Survey);

            if (NumberOfQuestions > 0)
            {
                return(RedirectToPage(
                           "/QuestionPages/CreateMultipleQuestions",
                           new { numberOfQuestionsLeft = NumberOfQuestions, surveyId = Survey.Id }));
            }
            return(RedirectToPage(
                       "./Details",
                       new { id = Survey.Id }));
        }