public JsonResult Create(LogisticsType obj) { try { if (IsCreateOk(obj.LogisticsCode)) return Json(new {errorMsg="此代码已存在,请检查后再创建!"}); obj.CreateOn = DateTime.Now; NSession.SaveOrUpdate(obj); NSession.Flush(); } catch (Exception ee) { return Json(new { IsSuccess = false, ErrorMsg = "出错了" }); } return Json(new { IsSuccess = true }); }
public ActionResult Edit(LogisticsType obj) { try { if (IsOk(obj.Id, obj.LogisticsCode)) return Json(new {errorMsg="此代码已存在,请检查后再作修改!" }); NSession.Update(obj); NSession.Flush(); } catch (Exception ee) { return Json(new { IsSuccess = false, ErrorMsg = "出错了" }); } return Json(new { IsSuccess = true }); }