public ActionResult CheckAnswer()
        {
            ExamViewModel examViewModel = new ExamViewModel();
            examViewModel.SideBarData = new SideBarViewModel();
            examViewModel.SideBarData.CurrentIndex = 2;
            int ProblemTotal = 0;
            int[] Ans = new int[200];
            int[] ProblemScore = new int[200];

               //  string examname=RouteData.Values["examName"].ToString();
            ExamBusinessLayer examBusinessLayer = new ExamBusinessLayer();
            List<Exam> exam = examBusinessLayer.GetExamList();
            // 获取考试题目分数和答案

            string examName = Request.Form["examName"].ToString();
            if (examName != null)
            {
                foreach (Exam t in exam)
                {
                    if (t.ExamName == examName)
                    {
                        Exam userexam = new Exam();
                        Ans[ProblemTotal] = t.Answer;
                        ProblemScore[ProblemTotal] = t.Score;
                        ProblemTotal++;
                    }
                }
            }

            int TotalScore = -1;
            int cnt = 0;
            for (int i = 0; i < ProblemTotal;i++)
            {
                if (Request.Form["examInfo[" + i + "].userAnswer"] == null)
                {
                    cnt++;
                    continue;
                }
                if (Request.Form["examInfo[" + i + "].userAnswer"].ToString()[0] - 'A'+1 == Ans[i])
                    TotalScore += ProblemScore[i];
            }
            if (cnt == ProblemTotal)
                TotalScore = 65535;
            examViewModel.ExamScore = TotalScore;

            if (HttpContext.Session["User"] != null && Session["User"].ToString() != "")
            {
                examViewModel.NavStatusData = new NavStatusViewModel();
                examViewModel.NavStatusData.LeftLink = "/User/Profile/" + HttpContext.Session["User"].ToString();
                examViewModel.NavStatusData.LeftText = Session["User"].ToString();
                examViewModel.NavStatusData.RightLink = "/User/Logout";
                examViewModel.NavStatusData.RightText = "Log out";
            }

            return View("Content", examViewModel);
        }
        public ActionResult ShowExam()
        {
            ExamViewModel examViewModel = new ExamViewModel();
            examViewModel.QuestionList = new List<Exam>();
            examViewModel.SideBarData = new SideBarViewModel();
            examViewModel.SideBarData.CurrentIndex = 2;

            ExamBusinessLayer examBusinessLayer = new ExamBusinessLayer();
            List<Exam> exam = examBusinessLayer.GetExamList();
            // 获取考试科目
            string examName = Convert.ToString(RouteData.Values["examName"]);
            if (examName != null)
            {
                foreach (Exam t in exam)
                {
                    if (t.ExamName == examName)
                    {
                        Exam userexam = new Exam();
                        userexam.ExamID = t.ExamID;
                        userexam.ExamName = t.ExamName;
                        userexam.Problem = t.Problem;
                        userexam.ProblemProperty = t.ProblemProperty;
                        userexam.Answer = t.Answer;
                        userexam.ImgSrc = t.ImgSrc;
                        userexam.Score = t.Score;
                        // single-choice question
                        if (userexam.ProblemProperty == 1)
                        {
                            userexam.First = t.First;
                            userexam.Second = t.Second;
                            userexam.Third = t.Third;
                            userexam.Fourth = t.Fourth;
                        }

                        examViewModel.QuestionList.Add(userexam);
                    }
                }
            }
            else
            {
                Response.Redirect("~");
            }

            examViewModel.QuestionNum = examViewModel.QuestionList.Count;
            examViewModel.Name = examName;
            examViewModel.ExamScore = -1;

            if (HttpContext.Session["User"] != null && Session["User"].ToString() != "")
            {
                examViewModel.NavStatusData = new NavStatusViewModel();
                examViewModel.NavStatusData.LeftLink = "/User/Profile/" + HttpContext.Session["User"].ToString();
                examViewModel.NavStatusData.LeftText = Session["User"].ToString();
                examViewModel.NavStatusData.RightLink = "/User/Logout";
                examViewModel.NavStatusData.RightText = "Log out";
            }

            return View("Content", examViewModel);
        }