public JsonResult _Edit(Role_U role) { try { _RoleFacade.Value.Edit(role); return(Json(AjaxResult.Success("修改成功!"))); } catch (Exception ex) { return(Json(AjaxResult.Error(ex.Message))); } }
/// <summary> /// 更新 /// </summary> /// <param name="model"></param> public void Edit(Role_U model) { using (var factory = new BaseAccess()) { if (!string.IsNullOrEmpty(model.ID)) { var model_old = factory.GetSingle <RoleEntity>(model.ID); model_old = model.Adapter <RoleEntity>(model_old);//将页面对象的属性转换到数据库对象modle中 factory.Update <RoleEntity>(model_old); //清理缓存 CacheshipFactory.Instance.ClearRoleCache(); } } }