public async Task <ActionResult> GetAsync() { var model = await _containerService .GetAsync(); if (model != null) { return(Ok(model.OrderBy(rec => rec.Name))); } return(NotFound()); }
public async Task Run(JobBO job) { if (job == null) { return; } if (job.DatabaseEnvironmentId == null) { return; } List <RuleBO> toRun = new List <RuleBO>(); var databaseEnvironment = await _databaseEnvironmentService.GetAsync(job.DatabaseEnvironmentId.Value); List <Guid> collections = new List <Guid>(); List <Guid> containers = new List <Guid>(); List <int> tags = new List <int>(); switch (job.Type) { case JobType.Tag: if (!job.TagId.HasValue) { return; } tags.Add(job.TagId.Value); break; case JobType.Container: var containerType = await _containerService.GetAsync(job.ContainerId.Value); if (containerType.ContainerTypeId == 1) { collections.Add(job.ContainerId.Value); } else { containers.Add(job.ContainerId.Value); } break; } var result = await _ruleService.SearchRulesAsync(collections, containers, tags, string.Empty, string.Empty, null, null); toRun.AddRange(result.Rules); toRun = toRun.Where(r => r.Id != Guid.Empty).ToList(); foreach (var r in toRun) { await _executionService.ExecuteRuleByEnvironmentIdAsync(r.Id, databaseEnvironment); } }