public async Task SetEnabled(int id, bool isEnabled) { using (var uow = UnitOfWorkProvider.Create()) { var rule = await _ruleRepository.GetById(id); rule.IsEnabled = isEnabled; await uow.CommitAsync(); } }
/// <summary> /// 根据主键获取一个规则 /// </summary> /// <param name="id">规则的主键</param> /// <returns>一个规则</returns> public Rule GetById(string id) { return(repository.GetById(db, id)); }