예제 #1
0
        private void StoreFoodIngredientsWithoutAllergens(List <Food> food)
        {
            var ingredientsThatDontContainGivenAllergen = food
                                                          .SelectMany(p => p.Ingredients)
                                                          .GroupBy(p => p)
                                                          .Select(p => p.Key)
                                                          .Where(p => !IngredientsWithAllergens.Contains(p))
                                                          .ToList();

            IngredientsWithoutAllergens.AddRange(ingredientsThatDontContainGivenAllergen);
        }
예제 #2
0
 private void RefreshIngredientsWithoutAllergens()
 {
     IngredientsWithoutAllergens = IngredientsWithoutAllergens.Distinct().ToList();
     IngredientsWithoutAllergens.RemoveAll(i => IngredientsWithAllergens.Contains(i));
 }