public ActionResult Edit(int id) { LogisticsModeType obj = GetById(id); ViewData["checked"] = obj.Discount; return(View(obj)); }
/// <summary> /// 根据Id获取 /// </summary> /// <param name="Id"></param> /// <returns></returns> public LogisticsModeType GetById(int Id) { LogisticsModeType obj = NSession.Get <LogisticsModeType>(Id); if (obj == null) { throw new Exception("返回实体为空"); } else { return(obj); } }
public JsonResult DeleteConfirmed(int id) { try { LogisticsModeType obj = GetById(id); NSession.Delete(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
public ActionResult Edit(LogisticsModeType obj) { try { if (IsOk(obj.Id, obj.ParentID, 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 })); }