}// /// <summary> /// 插入课程信息或者修改课程信息 /// </summary> /// <param name="form">课程信息表单</param> /// <returns></returns> public ActionResult ExecuteInsertAndUpdateCourseInfo(FormCollection form) { if (Session["UserType"] != null && Session["UserType"].ToString() == "Teacher") { if (Session["UserNum"] != null) { if (form["Action"] == "New") { CourseInfo c1 = FormToCourseInfo(form); if (c1.IsCheck) { if (CourseInfo.ExecuteInsertCourseInfo(c1) > 0) { return(Content("Success")); } else { return(Content("Error")); } } else { return(Content("Error")); } } else if (form["Action"] == "Save") { CourseInfo c1 = FormToCourseInfo(form); if (c1.IsCheck) { c1.CourseNum = form["CourseNum"]; if (CourseInfo.UpdateCourseInfo(c1) > 0) { return(Content("Success")); } else { return(Content("Error")); } } else { return(Content("Error")); } } else { return(Content("Error")); } } else { return(RedirectToAction("../Home/Login")); } } else { return(RedirectToAction("../Home/Login")); } }