示例#1
0
        public void TestModifyStatus()//注,当更新的值一样时不会执行更新操作,所以此测试只能通过一次
        {
            ExamModel model = new ExamModel();
            int i = model.modifyStatus(2, 1);
            Console.WriteLine(i);
            Assert.IsTrue(i == 1);

        }
示例#2
0
        public ActionResult ModifyExamStatus()
        {
            if (loginStatus() == false)
            {
                return Redirect("Login");
            }
            Dictionary<string, string> response = new Dictionary<string, string>();
            ExamModel examModel = new ExamModel();
            int id, status;
            try
            {
               id = int.Parse(Request["id"]);
                status = int.Parse(Request["status"]);
               int tmp = examModel.modifyStatus(id, status);
                if (tmp > 0)
                {
                   response.Add("status", "success");
 
               }
                else
                {
                    response.Add("status", "failed");
                    response.Add("error", "something wrong!");
                }
            }
            catch
            {
                response.Add("status", "failed");
                response.Add("error", "bad param!");
            }
            return Json(response);
       }