예제 #1
0
        public void OnGet(int TestID)
        {
            QuestionsInTest = new List <Question>();

            Test          = apTestData.GetTestByID(TestID);
            QuestionTests = apTestData.GetTestQuestions(TestID);


            for (int i = 0; i < QuestionTests.Count(); i++)
            {
                QuestionsInTest.Add(questionData.GetByQuestionID(QuestionTests[i].QuestionID));
            }

            foreach (var q in QuestionsInTest)
            {
                q.QuestionBody = q.QuestionBody.Replace("\n", "<br>");
            }

            ApplicantsOnTest      = apTestData.GetApplicantsAssignedToTestByID(TestID);
            ApplicantsOnTestCount = ApplicantsOnTest.Count();
        }
        public IActionResult OnPost(string[] userCheckboxes)
        {
            var TestUsers = apTestData.GetApplicantsAssignedToTestByID(Test.ID);

            if (TestUsers.Count == 0)
            {
                apTestData.AddApplicantsToTest(Test, userCheckboxes);
                TempData["Message"] = "Users Added to Test";
            }
            else
            {
                apTestData.UpdateApplicantsAssignedToTest(Test, userCheckboxes);
                TempData["Message"] = "Test Users Updated";
            }

            apTestData.Commit();

            return(RedirectToPage("./TestDetail", new { TestID = Test.ID }));
        }
예제 #3
0
        public IActionResult OnGet(int?TestID)
        {
            Questions           = apTestData.GetQuestionsAndAnswers();
            UsersAssignedToTest = apTestData.GetApplicantsAssignedToTestByID(TestID).Count();

            if (TestID.HasValue)
            {
                Test = apTestData.GetTestByID(TestID.Value);
            }
            else
            {
                Test = new Test();

                newTest = true;
            }

            if (Test == null)
            {
                return(RedirectToPage("./TestList"));
            }
            return(Page());
        }
예제 #4
0
 public int GetUsers(int TestID)
 {
     return(apTestData.GetApplicantsAssignedToTestByID(TestID).Count());
 }