Ejemplo n.º 1
0
        public async Task FilterProjects(ProjectsDto projects)
        {
            var rules   = LoadRules();
            var effects = new List <Task>();

            foreach (var rule in rules.Rules)
            {
                var exp              = _expressionBuilder.BuildExpression(rule);
                var func             = exp.Compile();
                var filteredProjects = projects.Projects.Where(func).ToList();

                if (filteredProjects.Any())
                {
                    foreach (var effect in rule.Effects)
                    {
                        effects.Add(ApplyEffect(effect, filteredProjects));
                    }
                }
            }

            await Task.WhenAll(effects);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Filter([FromBody] ProjectsDto model)
        {
            await _filterService.FilterProjects(model);

            return(Ok());
        }