/// <summary> /// check is valid test Id /// </summary> /// <param name="userInfo">SimleQPage contain all informationabout user fr validate id</param> /// <returns></returns> public static bool IsValidTest(SimleQPage userInfo) { if (PersonalTestProgress[userInfo.UssrName].ComapareTestId(userInfo.TestId)) { return(true); } return(false); }
public ActionResult Index(SimleQPage answer, EnumButtons Next) { if (!TestProgres.IsValidTest(answer)) return View("Error"); TestProgres.UpdateQuestionsForUser(answer); if (Next == EnumButtons.Done) return RedirectToRoute(new { controller = "test", action = "Ressult", TestId = TestProgres.GetTestId(answer.UssrName) }); return RedirectToRoute(new { controller = "test", action = "Index", id = TestProgres.IncremenCurrentPage(answer.UssrName) }); }
/// <summary> /// Set page with answers in personal page in dictionary /// </summary> /// <param name="answers">User's answers</param> public static void UpdateQuestionsForUser(SimleQPage answers) { PersonalTestProgress[answers.UssrName].questions[answers.CurrentPage - 1] = answers.questions; }