Exemplo n.º 1
0
        public IActionResult OnPost(int questionID)
        {
            questionData.DeleteQuestion(questionID);
            questionData.Commit();
            TempData["Message"] = "Question has successfully been deleted";

            return(RedirectToPage("./List"));
        }
Exemplo n.º 2
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                QuestionTypes = htmlHelper.GetEnumSelectList <QuestionTypeID>();
                return(Page());
            }


            if (Question.ID > 0)
            {
                questionData.UpdateQuestion(Question);
                TempData["Message"] = "Question has been successfully updated";
            }
            else
            {
                questionData.AddQuestion(Question);
                TempData["Message"] = "Question has been successfully created";
            }

            questionData.Commit();

            return(RedirectToPage("./Detail", new { QuestionID = Question.ID }));
        }