public ActionResult Edit_DB_AD() { this.Response.ContentType = "text/plain"; NModel.DB_AD model = new NModel.DB_AD(); BLL.DB_AD dal = new BLL.DB_AD(); String JsonStr = ""; bool isGet = Tool.NStr.PostForSetVal <NModel.DB_AD>(ref model, ref JsonStr, ""); // 下面代码编写 if (isGet && !string.IsNullOrEmpty(model.AD_Name) && !string.IsNullOrEmpty(model.AD_Num) && !string.IsNullOrEmpty(model.AD_Img) && model.AD_AddTime != null ) { //取默认值 model.AD_EditTime = DateTime.Parse(DateTime.Now.ToString("s")); bool isEdit = dal.Edit(model) > 0 ? true : false; string msg = dal.ErrorMsg; if (!string.IsNullOrEmpty(msg)) { msg = "原因:" + msg; } if (isEdit) { this.Response.Write(Tool.NMsg.SetMsg("修改成功", "1")); this.Response.End(); } else { this.Response.Write(Tool.NMsg.SetMsg("修改失败" + msg, "0")); this.Response.End(); } dal.Close(); } else { this.Response.Write(Tool.NMsg.SetMsg("提交失败", "0")); this.Response.End(); } return(View()); }
public ActionResult Add_DB_AD() { this.Response.ContentType = "text/plain"; NModel.DB_AD model = new NModel.DB_AD(); BLL.DB_AD dal = new BLL.DB_AD(); String JsonStr = ""; bool isGet = Tool.NStr.PostForSetVal <NModel.DB_AD>(ref model, ref JsonStr, ""); // 下面代码编写 if (isGet && !string.IsNullOrEmpty(model.AD_Name) && !string.IsNullOrEmpty(model.AD_Num) && !string.IsNullOrEmpty(model.AD_Img) ) { { model.AD_EditTime = DateTime.Parse(DateTime.Now.ToString("s")); model.AD_AddTime = DateTime.Parse(DateTime.Now.ToString("s")); // bool isAdd = dal.Add(model) > 0 ? true : false; if (isAdd) { this.Response.Write(Tool.NMsg.SetMsg("增加成功", "1")); this.Response.End(); } else { this.Response.Write(Tool.NMsg.SetMsg("增加失败" + dal.ErrorMsg, "1")); this.Response.End(); } } } else { this.Response.Write(Tool.NMsg.SetMsg("提交失败", "0")); } dal.Close(); return(View()); }