/// <summary> /// 更新一条结业考试试题记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateCourseTest(Course_Test model) { if (model.Question == null) { model.Question = ""; } return dal.UpdateCourseTest(model) > 0; }
public ActionResult EditUnitTest(Course_Test model) { Course_UnitTestBLL bll = new Course_UnitTestBLL(); if (bll.UpdateCourseTest(model)) { return Json(new { Result = true, Msg = "修改成功!" }, JsonRequestBehavior.AllowGet); } else { return Json(new { Result = false, Msg = "修改失败!" }, JsonRequestBehavior.AllowGet); } }
/// <summary> /// 更新一条结业考试试题记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public int UpdateCourseTest(Course_Test model) { StringBuilder sql = new StringBuilder(); sql.Append("update [dbo].[Course_UnitTest] set "); sql.Append("[Content]=@Content,[QTtype]=@QTtype,[Question]=@Question,[Answer]=@Answer,[Credit]=@Credit"); sql.Append(" where [Id]=@Id"); SqlParameter[] cmdParams = new SqlParameter[] { new SqlParameter("@Id", SqlDbType.Int, 4) { Value = model.Id }, new SqlParameter("@Content", SqlDbType.VarChar, 2000) { Value = model.Content }, new SqlParameter("@QTtype", SqlDbType.Int, 4) { Value = model.QTtype }, new SqlParameter("@Question", SqlDbType.VarChar, 8000) { Value = model.Question }, new SqlParameter("@Answer", SqlDbType.VarChar, 100) { Value = model.Answer }, new SqlParameter("@Credit", SqlDbType.Float, 8) { Value = model.Credit }, }; return MSEntLibSqlHelper.ExecuteNonQueryBySql(sql.ToString(), cmdParams); }