public IEnumerable <RecipeDetailsDto> Handle(FindRecipeDetailsQuery query) { var filterCriteria = new RecipeSearchFilterCriteria(query, Deviation); var recipes = _recipeDetailsRepository.FindRecipesDetails(filterCriteria); return(recipes.Select(RecipeDetailsDto.FromRecipeDetails) .ToList()); }
public IEnumerable <RecipeDetails> FindRecipesDetails(RecipeSearchFilterCriteria filterCriteria) { var filters = _filterFactory.Build(filterCriteria); var recipes = _cachingProvider .GetByPrefix <RecipeDetails>(nameof(RecipeDetails)) .Values; return(recipes .Select(x => x.Value) .Where(x => filters.All(filter => filter.Satisfy(x))) .ToList()); }