static RecipeFactory() { var granolaBar = new Recipe(1, "Granola Bar"); granolaBar.AddIngredient(3001, 1); granolaBar.AddIngredient(3002, 1); granolaBar.AddIngredient(3003, 1); granolaBar.AddOutput(2001, 1); s_recipes.Add(granolaBar); }
public Recipe ToRecipe() { var item = new Recipe(Id, Name); if (Ingredients?.Any() ?? false) { foreach (var child in Ingredients) { item.AddIngredient(child.Id, child.Quantity); } } if (Output?.Any() ?? false) { foreach (var child in Output) { item.AddOutput(child.Id, child.Quantity); } } return(item); }