public ActionResult GetExam(int id) { Exam currentExam = _examService.GetByID(id); Question currentQuestion = currentExam.Questions.ToList()[0]; Session["Correct"] = 0; Session["Wrong"] = 0; Session["Exam"] = currentExam; Session["Question"] = currentQuestion; return(View(currentExam)); }
public IHttpActionResult GetByID(int id) { Exam exam = _examService.GetByID(id); if (exam == null) { return(NotFound()); } else { return(Ok(exam)); } }
public ActionResult GetExam(int id) { Exam currentExam = _examService.GetByID(id); Question currentQuestion = Session["CurrentQuestion"] == null?currentExam.Questions.ToList()[0] : Session["CurrentQuestion"] as Question; Session["Correct"] = Session["Correct"] == null ? 0 : Session["Correct"]; Session["Wrong"] = Session["Wrong"] == null ? 0 : Session["Wrong"]; Session["Left"] = Session["Left"] == null ? currentExam.Questions.Count : Session["Left"]; Session["Exam"] = currentExam; Session["CurrentQuestion"] = currentQuestion; ViewBag.Time = 120 / 60; return(View(currentExam)); }