/// <summary> /// Method to add an ingredient to a recipe /// </summary> /// <param name="recipe">The recipe to add the ingredient to</param> /// <param name="ingredient">The ingredient to add the recipe to</param> public async Task AddIngredientToRecipeAsync(ComboBox recipe, ComboBox ingredient) { var isRecipeValid = recipeUI.ValidationObject.ValidateRecipeSelection(recipe); var isIngredientValid = ValidationObject.ValidateIngredientSelection(ingredient); //Check if the recipe and ingredient is valid if (isRecipeValid && isIngredientValid) { var recipeToAddIngredientTo = recipe.SelectedItem as RecipeDTO; var ingredientToAddToRecipe = ingredient.SelectedItem as IngredientDTO; var added = await BusinessObject.AddIngredientToRecipeAsync(recipeToAddIngredientTo, ingredientToAddToRecipe); if (added) { ShowMessage($"Ingredient {ingredientToAddToRecipe.Name} Added To Recipe {recipeToAddIngredientTo.Name}"); } else { ShowMessage($"Ingredient {ingredientToAddToRecipe.Name} Not Added To Recipe {recipeToAddIngredientTo.Name}"); } } }