예제 #1
0
        public IActionResult OnPost(string[] checkboxes)
        {
            if (Test.ID > 0)
            {
                apTestData.UpdateTest(Test);
                apTestData.UpdateTestQuestions(Test, checkboxes);
                TempData["Message"] = "Test has been updated";
            }
            else
            {
                var CreatedTest = apTestData.AddTest(Test);
                apTestData.Commit();

                apTestData.AddQuestionsToTest(CreatedTest, checkboxes);
                TempData["Message"] = "Test has been created";
            }

            apTestData.Commit();

            return(RedirectToPage("./TestDetail", new { TestID = Test.ID }));
        }