public static Tuple <List <EQuestion>, List <EUserResult> > GetContentOfTest(ETest test) { List <EQuestion> questions = QuestionContext.GetByTest(test.Id); //get list answers List <EUserResult> answers = UserResultContext.GetByTest(test.Id); Tuple <List <EQuestion>, List <EUserResult> > list = Tuple.Create(questions, answers); return(list); }
public ActionResult Test(int IdTest) { var user = (User)Session[Common.USER_SESSION]; ETest test = TestContext.SearchTestOfUser(IdTest, user.Id); if (test == null) { return(null); } // new Test if (test.Status.ToUpper() == "NotStart".ToUpper()) { int count = UserResultContext.AddTest(test.Id); if (count == 0) { return(RedirectToAction("Index")); } } else if (test.Status == Entity.baseEmun.StaticTest.Finish.ToString()) { return(RedirectToAction("Index")); } else if (test.TimeStart != null) { DateTime timeNow = DateTime.Now; if (timeNow - test.TimeStart > test.Time) { BLTest.CheckIsFinish(test.Id); return(RedirectToAction("Index")); } test.Time = test.Time - (TimeSpan)(timeNow - test.TimeStart); } ViewData["user"] = user; ViewData["Test"] = test; return(View()); }