public ExpandedIngredientViewModel(IngredientsParser.ParsedIngredient parsedIngredient, ProductViewModel productVm) : base(parsedIngredient, productVm) { Ingredients = new ObservableCollection <IngredientViewModel>(); foreach (var ingredient in ParsedIngredient.Ingredients) { var ingredientVm = new IngredientViewModel(ingredient, this.Product); ingredientVm.Parent = this; Ingredients.Add(ingredientVm); } }
private EUAdditiveViewModel DetectEUNumber(IngredientsParser.ParsedIngredient ingredient, EUAdditiveLanguageNames euNumbers) { var results = euNumbers.GetEUAdditiveNumber(ingredient.Name, Product.LanguageCode); if (results.Count() == 1) { return(new EUAdditiveViewModel(results.First().EUNumber, results.First().Name)); } return(null); }
public IngredientViewModel(IngredientsParser.ParsedIngredient parsedIngredient, ProductViewModel productVm) { ParsedIngredient = parsedIngredient; Product = productVm; }