private async Task <ComplexRecipeComponent> RecipeCostDB(Recipe recipe, Chain chainFilter) { double recipeCost = 0; ComplexRecipeComponent cRP = new ComplexRecipeComponent(); foreach (var ing in recipe._ingredientList) { double cost = await _dc.Product.CheapestPrice(ing._ingredientName, chainFilter); recipeCost += cost; } cRP.RecipeCost = recipeCost; return(cRP); }
//Calls the the parent class' constructor, and initializes the _complexRecipeComponent public ComplexRecipe(int recipeID, string name, string description, List <BBCollection.BBObjects.Ingredient> ingredientList, float PerPerson, ComplexRecipeComponent complexRecipeComponent) : base(recipeID, name, description, ingredientList, PerPerson) { _complexRecipeComponent = complexRecipeComponent; }