//ajax提交处理的action public ActionResult AddAction(JiaoXueJieDuanBiao jxjd) { if (jxjd.ShenHeShiFouTongGuo == null) { jxjd.ShenHeShiFouTongGuo = false; } if (jxjd.ShiFouQiYong == null) { jxjd.ShiFouQiYong = false; } var jdm = bll.SelectGetName(jxjd.JieDuanMing); if (jdm == null) { int n = bll.Addjiaoxuejieduan(jxjd); if (n > 0) { return(Json(new { errorNo = "0", errorInfo = "教学阶段新增成功" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { errorNo = "1", errorInfo = "教学阶段新增失败,请检查重试" }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { errorNo = "1", errorInfo = "此阶段名已经存在,请重新输入" }, JsonRequestBehavior.AllowGet)); } }
//修改时提交 public ActionResult UpdateAction(JiaoXueJieDuanBiao jxjd) { if (jxjd.ShenHeShiFouTongGuo == null) { jxjd.ShenHeShiFouTongGuo = false; } if (jxjd.ShiFouQiYong == null) { jxjd.ShiFouQiYong = false; } var name = bll.SelectGetName(jxjd.JieDuanMing, jxjd.ID); if (A == false) { if (name == null) { int n = bll.Updatejiaoxuejieduan(jxjd); if (n > 0) { return(Json(new { errorNo = "0", errorInfo = "教学阶段基本信息修改成功" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { errorNo = "1", errorInfo = "教学阶段基本信息修改失败,请检查重试" }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { errorNo = "1", errorInfo = "此阶段名已经存在,请重新输入" }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { errorNo = "1", errorInfo = "审核已通过,不能修改" }, JsonRequestBehavior.AllowGet)); } }
//1.以对象删除 public int Detelejiaoxuejieduan(JiaoXueJieDuanBiao jxjd) { return(dal.Deletejiaoxuejieduan(jxjd)); }
public int Updatejiaoxuejieduan(JiaoXueJieDuanBiao jxjd) { return(dal.Updatejiaoxuejieduan(jxjd)); }
public int Addjiaoxuejieduan(JiaoXueJieDuanBiao jxjd) { return(dal.Addjiaoxuejieduan(jxjd)); }
public int Deletejiaoxuejieduan(JiaoXueJieDuanBiao jxjd) { context.Set <JiaoXueJieDuanBiao>().Attach(jxjd); context.Set <JiaoXueJieDuanBiao>().Remove(jxjd); return(context.SaveChanges()); }
public int Updatejiaoxuejieduan(JiaoXueJieDuanBiao jxjd) { context.Set <JiaoXueJieDuanBiao>().Attach(jxjd); context.Entry <JiaoXueJieDuanBiao>(jxjd).State = EntityState.Modified; return(context.SaveChanges()); }
public int Addjiaoxuejieduan(JiaoXueJieDuanBiao jxjd) { context.Set <JiaoXueJieDuanBiao>().Add(jxjd); return(context.SaveChanges()); }