public static void AddProduct(int amountOfIngredeints, string productName, string veriety, double size, string containerType, double productPrice, string ingredOne, string ingredTwo) { //need to add a way of finding the ingredient based on the name, on this method!!! Ingredient ingredientOne; Ingredient ingredientTwo; ingredientOne = new Ingredient("Apple", 2600, 2); //Only a placeholder for the actual coding ingredientTwo = new Ingredient("Evil", 3600, 2.3); //Only a placeholder for the actual coding ProductList.Add(new Product(amountOfIngredeints, productName, veriety, size, containerType, productPrice, ingredientOne, ingredientTwo)); }
/// <summary> /// Full-args constructor, that adds the ingredients given to the ingredient list. /// </summary> /// <param name="amountOfIngredient"></param> /// <param name="productName"></param> /// <param name="variety"></param> /// <param name="size"></param> /// <param name="containerType"></param> /// <param name="fruitAmountPer100g"></param> /// <param name="productPrice"></param> /// <param name="IngredientOne"></param> /// <param name="IngredientTwo"></param> public Product(int amountOfIngredient, string productName, string variety, double size, string containerType, double fruitAmountPer100g, double productPrice, Ingredient IngredientOne, Ingredient IngredientTwo) { AmountOfIngredient = amountOfIngredient; ProductName = productName; Variety = variety; Size = size; ContainerType = containerType; ProductPrice = productPrice; for (int i = 0; i < amountOfIngredient; i++) { IngredientList.Add(IngredientOne); IngredientList.Add(IngredientTwo); } }
/// <summary> /// Full-args constructor, that adds the ingredients given to the ingredient list. /// </summary> /// <param name="amountOfIngredient"></param> /// <param name="productName"></param> /// <param name="variety"></param> /// <param name="size"></param> /// <param name="containerType"></param> /// <param name="productPrice"></param> /// <param name="IngredientOne"></param> /// <param name="IngredientTwo"></param> public Product(int amountOfIngredient, string productName, string variety, double size, string containerType, double productPrice, Ingredient IngredientOne, Ingredient IngredientTwo) { AmountOfIngredient = amountOfIngredient; ProductName = productName; Variety = variety; Size = size; ContainerType = containerType; ProductPrice = productPrice; if (amountOfIngredient == 1) { IngredientList.Add(IngredientOne); } else if (amountOfIngredient == 2) { IngredientList.Add(IngredientOne); IngredientList.Add(IngredientTwo); } }