//[SupportFilter] public ActionResult Edit(int id, SMROLETB entity) { if (entity != null && ModelState.IsValid) { //数据校验 entity.UPDATE_USER = UserId; string returnValue = string.Empty; SMLOG OperLog = new SMLOG { OPERATION_TYPE = "U", FUNC_CODE = "010701", USER_ID = UserId, CLASSNAME = this.GetType().ToString() + strEdit }; if (SMROLETBService.Edit(entity)) { OperLog.REMARK = "角色:" + entity.ROLE_NAME + Suggestion.UpdateSucceed; SMLOGService.AddEntity(OperLog); //写入日志 return(Json(Suggestion.UpdateSucceed)); //提示更新成功 } else { OperLog.REMARK = "角色:" + entity.ROLE_NAME + Suggestion.UpdateFail + returnValue; return(Json(Suggestion.UpdateFail + returnValue)); //提示更新失败 } } return(Json(Suggestion.UpdateFail + "请核对输入的数据的格式")); //提示输入的数据的格式不对 }
//[SupportFilter] public ActionResult Create(SMROLETB entity) { if (entity != null && ModelState.IsValid) { entity.CREATION_TIME = DateTime.Now; entity.CREATION_USER = UserId; string returnValue = string.Empty; SMLOG OperLog = new SMLOG { OPERATION_TYPE = "N", FUNC_CODE = "010701", USER_ID = UserId, CLASSNAME = this.GetType().ToString() + strCreate }; var result = SMROLETBService.Create(entity); if (result != null) { OperLog.REMARK = "角色:" + entity.ROLE_NAME + Suggestion.InsertSucceed; SMLOGService.AddEntity(OperLog);//写入日志 return(Json(Suggestion.InsertSucceed)); } else { OperLog.REMARK = "角色:" + entity.ROLE_NAME + Suggestion.InsertFail; SMLOGService.AddEntity(OperLog); //写入日志 return(Json(Suggestion.InsertFail + returnValue)); //提示插入失败 } } return(Json(Suggestion.InsertFail + ",请核对输入的数据的格式")); //提示输入的数据的格式不对 }
/// <summary> /// 首次编辑 /// </summary> /// <param name="id">主键</param> /// <returns></returns> //[SupportFilter] public ActionResult Edit(int id) { SMROLETB item = SMROLETBService.LoadEntities(r => r.ROLE_ID == id).FirstOrDefault(); return(View(item)); }