public ActionResult Edit(UserSetupType obj) { try { NSession.Update(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { errorMsg = "出错了" })); } return(Json(new { IsSuccess = "true" })); }
/// <summary> /// 根据Id获取 /// </summary> /// <param name="Id"></param> /// <returns></returns> public UserSetupType GetById(int Id) { UserSetupType obj = NSession.Get <UserSetupType>(Id); if (obj == null) { throw new Exception("返回实体为空"); } else { return(obj); } }
public JsonResult DeleteConfirmed(int id) { try { UserSetupType obj = GetById(id); NSession.Delete(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { errorMsg = "出错了" })); } return(Json(new { IsSuccess = "true" })); }
public JsonResult Create(UserSetupType obj) { try { obj.CreateOn = DateTime.Now; obj.CreateBy = GetCurrentAccount().Realname; RoleEnum displayType = (RoleEnum)System.Enum.Parse(typeof(RoleEnum), obj.SetupID.ToString()); obj.SetupName = displayType.ToString(); UserType user = NSession.Get <UserType>(obj.UId); obj.RealName = user.Realname; NSession.SaveOrUpdate(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { errorMsg = "出错了" })); } return(Json(new { IsSuccess = "true" })); }
public ActionResult Edit(int id) { UserSetupType obj = GetById(id); return(View(obj)); }