public async Task <int> UpdateState(int id, DataAuthRuleState state) { int ruleId = await Daos.CurrentDao.Update <DataAuthRule>(i => i.Id == id, i => new DataAuthRule { RuleState = state }); cache.Remove(this.DATAAUTHRULE_CACHE_KEY); return(ruleId); }
public async Task <Expression <Func <T, bool> > > GetExpression <T>(string factoryName, DataAuthRuleState ruleState = DataAuthRuleState.Using) where T : EntityBase { var rule = await Daos.CurrentDao.SingleAsync <DataAuthRule>(d => d.Repository == factoryName && typeof(T).AssemblyQualifiedName == d.EntityType && d.RuleState == ruleState); if (rule == null) { return(null); } var ruleGroup = JsonSerializer.Deserialize <RuleGroup>(rule.RuleGroup); var envDic = enviroment.ToEnviromentDictionary(); return((Expression <Func <T, bool> >)ruleGroup.GetExpression(envDic)); }
public async Task <ResponseResult> UpdateState(int ruleId, DataAuthRuleState state) { await _dataAuthService.UpdateState(ruleId, state); return(new ResponseResult()); }