コード例 #1
0
ファイル: Question.cshtml.cs プロジェクト: Cyrilchc/Queezie
        /// <summary>
        /// Adds a new question.
        /// </summary>
        /// <returns>Refresh the page.</returns>
        public async Task <IActionResult> OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            QuestionData      questionData     = new QuestionData(_db);
            DataQuestionModel newQuestionModel = new DataQuestionModel
            {
                Question       = DisplayQuestion.Question,
                DomainId       = DisplayQuestion.DomainId,
                Id             = DisplayQuestion.Id,
                QuestionTypeId = DisplayQuestion.QuestionTypeId,
            };

            await questionData.InsertQuestion(newQuestionModel);

            return(RedirectToPage("./question"));
        }