public ActionResult MarkExam() { if (Session["UserName"] == null) { return(RedirectToAction("LoginUser", "Login")); } Result rs = new Result(); Exam exam = Session["Exam"] as Exam; if (!exam.Status) { return(RedirectToAction("Index", "ReSubmit_Error")); } exam.Status = false; rs.Num_of_quizs = exam.Quizs.Count; exam.Mark_exam(db); rs.Num_of_correct_answers = exam.Count_correct_answers(db); rs.Score = Get_total_score(rs); Save_total_score_to_db(exam.Id_de_thi, rs.Score); return(RedirectToAction("Index", rs)); }