public ActionResult Navigation(Guid quizId, Guid testId) { bl_QuestionGroup bl_group = new bl_QuestionGroup(); List <ps_PartViewItem> model = new List <ps_PartViewItem>(); for (byte i = 1; i <= 8; i++) { model.Add(new ps_PartViewItem { PartName = String.Format("Part{0}", i), TestId = testId, Groups = bl_group.GetByPartId(quizId, i) }); } bl_Answer blAnswer = new bl_Answer(); ViewBag.Done = blAnswer.GetNumberOfDone(testId); ViewBag.TestId = testId; //get the rest time bl_Test blTest = new bl_Test(); var test = blTest.GetById(testId); double restTime = (test.StartTime.AddHours(2) - DateTime.Now).TotalSeconds; ViewBag.Minute = Math.Round(restTime / 60, 0) - 1; ViewBag.Second = Math.Round(restTime % 60, 0); return(View("_Navigation", model)); }
public ActionResult View(Guid groupId, Guid testId) { bl_Test bl_test = new bl_Test(); bl_QuestionGroup bl_group = new bl_QuestionGroup(); bl_Question bl_question = new bl_Question(); bl_Answer bl_answer = new bl_Answer(); var test = bl_test.GetById(testId); var time = test.StartTime.AddHours(2) - DateTime.Now; var group = new ps_Group(); group.Group = bl_group.GetById(groupId); group.Group.Paragraph = HttpUtility.HtmlDecode(group.Group.Paragraph); group.QuestionList = bl_question.GetByGroupId(groupId); ViewBag.QuizId = group.Group.QuizId; ViewBag.GroupId = group.Group.QuestionGroupId; ViewBag.TestId = testId; ViewBag.TimeLeft = String.Format("{0}h{1}m{2}s", time.Hours, time.Minutes, time.Seconds); ViewBag.QuestionDone = bl_answer.GetQuestionDone(testId).Count; double Timeab = time.TotalSeconds; ViewBag.Time = Timeab; return(View(group)); }
public ActionResult RunNav(Guid testId) { bl_Test bl_test = new bl_Test(); bl_QuestionGroup bl_group = new bl_QuestionGroup(); Guid quizId = bl_test.GetById(testId).QuizId; Guid groupId = bl_group .GetByPartId(quizId, 1).OrderBy(m => m.Order) .First().QuestionGroupId; return(RedirectToAction("Run", new { groupId = groupId, testId = testId })); }
public ActionResult Result(Guid testId) { bl_Test blTest = new bl_Test(); bl_Quiz blQuiz = new bl_Quiz(); bl_Answer blAnswer = new bl_Answer(); ps_Result model = new ps_Result(); model.AnswerList = blAnswer .GetByTestId(testId) .OrderBy(m => m.bq_Question.Order) .ToList(); var test = blTest.GetById(testId); var quiz = blQuiz.GetById(test.QuizId); model.TestModel = test; model.QuizModel = quiz; return(View(model)); }
public ActionResult Run(Guid groupId, Guid testId) { bl_Test bl_test = new bl_Test(); bl_QuestionGroup bl_group = new bl_QuestionGroup(); bl_Question bl_question = new bl_Question(); bl_Answer bl_answer = new bl_Answer(); var test = bl_test.GetById(testId); var time = test.StartTime.AddHours(2) - DateTime.Now; var group = new ps_Group(); group.Group = bl_group.GetById(groupId); group.QuizId = group.Group.QuizId; group.TestId = testId; group.Group.Paragraph = HttpUtility.HtmlDecode(group.Group.Paragraph); group.QuestionList = bl_question.GetByGroupId(groupId); group.AnswerList = bl_answer.GetByGroupId(groupId, testId); return(View(group)); }