public IActionResult OnPost(List <Answer> answers, QuestionTypeID QuestionTypeID, int TestID) { Results = new List <double>(); Test = ApTestData.GetTestByID(TestID); AppUser appUser = new AppUser { Email = User.Identity.Name, }; ApTestData.SaveAnswerAttempt(answers, appUser, Test); if (answers.Count > 0) { ApTestData.Commit(); } switch (QuestionTypeID) { case QuestionTypeID.Written_and_Verbal_Reasoning: { TempData["Section1ResultString"] = ApTestData.CalculateCorrectAnswers(answers, appUser, QuestionTypeID, Questions.Count, Test).ToString(); return(RedirectToPage("./TestSectionHome/", new { TestID, QuestionTypeID = QuestionTypeID.Diagrammatic_Reasoning })); } case QuestionTypeID.Diagrammatic_Reasoning: { TempData["Section2ResultString"] = ApTestData.CalculateCorrectAnswers(answers, appUser, QuestionTypeID, Questions.Count, Test).ToString(); return(RedirectToPage("./TestSectionHome/", new { TestID, QuestionTypeID = QuestionTypeID.Symbolic_Manipulation })); } case QuestionTypeID.Symbolic_Manipulation: { TempData["Section3ResultString"] = ApTestData.CalculateCorrectAnswers(answers, appUser, QuestionTypeID, Questions.Count, Test).ToString(); Results.Add(Double.Parse(TempData["Section1ResultString"].ToString())); Results.Add(Double.Parse(TempData["Section2ResultString"].ToString())); Results.Add(Double.Parse(TempData["Section3ResultString"].ToString())); ApTestData.SaveTestResults(Results, TestID, appUser); ApTestData.Commit(); return(RedirectToPage("./TestComplete/")); } default: { return(Page()); } } }
public string GetTestName(int testID) { var test = ApTestData.GetTestByID(testID); return(test.TestName); }
public void OnGet(QuestionTypeID QuestionTypeID, int TestID) { Test = ApTestData.GetTestByID(TestID); this.QuestionTypeID = QuestionTypeID; this.TestCategoryTitle = QuestionTypeID.GetTestCategoryTitle(); }
public void OnGet(QuestionTypeID QuestionTypeID, int TestID) { Questions = ApTestData.GetQuestionListForTestByQuestionType(TestID, QuestionTypeID); Test = ApTestData.GetTestByID(TestID); this.TestCategoryTitle = QuestionTypeID.GetTestCategoryTitle(); }