public Recipe(string name, List <Ingridient> ingridients, string cooking, int numberOfServings, CaloricContent calContent, int id = 0) { Id = id; Name = name; Ingridients = ingridients; Cooking = cooking; NumberOfServings = numberOfServings; CalContent = calContent; }
public Recipe() { Id = 0; Name = String.Empty; Ingridients = new List <Ingridient>(); Cooking = String.Empty; NumberOfServings = 0; CalContent = new CaloricContent(); }
public void AddRecipe(String newName, List <Ingridient> newIngridients, String newCooking, Int32 newNumberOfServings, CaloricContent newCalContent) { Recipe newRecipe = new Recipe(); newRecipe.Name = newName; newRecipe.Ingridients = newIngridients; newRecipe.Cooking = newCooking; newRecipe.NumberOfServings = newNumberOfServings; newRecipe.CalContent = newCalContent; if (_recipes != null && _recipes.Count > 0) { newRecipe.Id = _recipes.Last().Id; } else { newRecipe.Id = 1; } if (_recipes != null) { _recipes.Add(newRecipe); } WriteData(); }