public ActionResult SaveSMS() { if (ModelState.IsValid) { bool save = true; try { BLL.Notice.Back back = new BLL.Notice.Back(); TBackCallSM sms = new TBackCallSM(); sms.接收内容 = Request.Form["SmsReply"]; sms.编码 = int.Parse(Request.Form["Code"]); back.SaveBackSM(sms); } catch (Exception) { save = false; } if (save) { return(Json(new { IsSuccess = true, Message = "保存成功" }, "text/html", JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = false, Message = "保存失败" }, "text/html", JsonRequestBehavior.AllowGet)); } } return(View()); }
public static void SaveBackSM(TBackCallSM entity) { using (MainDataContext dbContext = new MainDataContext(AppConfig.ConnectionStringDispatch)) { var model = dbContext.TBackCallSM.FirstOrDefault(t => t.编码 == entity.编码); model.接收内容 = entity.接收内容; dbContext.SubmitChanges(); } }
public ActionResult GetBackSM(int?code) { if (code == null) { return(Json(new { Result = false })); } BLL.Notice.Back back = new BLL.Notice.Back(); TBackCallSM result = back.GetBackSM((int)code); if (result != null) { return(Json(new { Result = true, Send = result.发送内容, Accept = result.接收内容 })); } else { return(Json(new { Result = false })); } }
public void SaveBackSM(TBackCallSM entity) { DAL.Notice.Back.SaveBackSM(entity); }