public async Task <IEnumerable <FilterDto> > GetFilters() { var filters = await _repository.GetAll(); var filtersDto = _mapper.Map <IEnumerable <FilterDto> >(filters); return(filtersDto); }
public void Execute(UpdatePlotsCommand command) { var filters = _filterRepository.GetAll(); var query = _rowRepository.GetAll(); var predicates = filters .Select(p => p.CreatePredicate()) .ToList(); predicates.ForEach(p => query = query.Where(p)); var rows = query.ToList(); var scatterPlot = _viewRepository.Get <ScatterPlot>(); var layout = scatterPlot.GetLayout(); var plots = _renderer.RenderPlots(rows, layout); scatterPlot.SetPlots(plots); }
public async Task <AccountFilterResult> Check(IEnumerable <Claim> claims) { if (claims == null) { throw new ArgumentNullException(nameof(claims)); } var accountFilterRules = new List <AccountFilterRuleResult>(); var filters = await _filterRepository.GetAll(); if (filters != null) { foreach (var filter in filters) { var accountFilterRule = new AccountFilterRuleResult(filter.Name); var errorMessages = new List <string>(); if (filter.Rules != null) { foreach (var rule in filter.Rules) { var claim = claims.FirstOrDefault(c => c.Type == rule.ClaimKey); if (claim == null) { errorMessages.Add($"the claim '{rule.ClaimKey}' doesn't exist"); continue; } switch (rule.Operation) { case ComparisonOperations.Equal: if (rule.ClaimValue != claim.Value) { errorMessages.Add($"the filter claims['{claim.Type}'] == '{rule.ClaimValue}' is wrong"); } break; case ComparisonOperations.NotEqual: if (rule.ClaimValue == claim.Value) { errorMessages.Add($"the filter claims['{claim.Type}'] != '{rule.ClaimValue}' is wrong"); } break; case ComparisonOperations.RegularExpression: var regex = new Regex(rule.ClaimValue); if (!regex.IsMatch(claim.Value)) { errorMessages.Add($"the filter claims['{claim.Type}'] match regular expression {rule.ClaimValue} is wrong"); } break; } } } accountFilterRule.ErrorMessages = errorMessages; accountFilterRule.IsValid = !errorMessages.Any(); accountFilterRules.Add(accountFilterRule); } } if (!accountFilterRules.Any()) { return(new AccountFilterResult { IsValid = true }); } return(new AccountFilterResult { AccountFilterRules = accountFilterRules, IsValid = accountFilterRules.Any(u => u.IsValid) }); }
public async Task <IActionResult> GetFilters() { var filters = await _filterRepository.GetAll(); return(new OkObjectResult(filters.ToDtos())); }
public List <Filter> GetAllFilters() { return(_filterRepository.GetAll() ?? new List <Filter>()); }
public IEnumerable <Filter> GetAllFilters() { return(_filterRepository.GetAll()); }
public List <Filter> Execute(GetFiltersQuery query) { return(_repository.GetAll()); }
public IEnumerable <Filter> GetFilters() { var filters = filtersRepository.GetAll(); return(filters); }