//Update public bool UpdateIngredient(string originalIngredient, IngredientsContent newIngredient) { IngredientsContent oldIngredient = GetIngredientByName(originalIngredient); if (oldIngredient != null) { oldIngredient.IngredientName = newIngredient.IngredientName; return(true); } else { return(false); } int initialCount = _listOfIngredients.Count; _listOfIngredients.Remove(oldIngredient); if (initialCount > _listOfIngredients.Count) { return(true); } else { return(false); } }
//Delete public bool RemoveIngredient(string ingredientName) { IngredientsContent ingredient = GetIngredientByName(ingredientName); if (ingredient == null) { return(false); } int initialCount = _listOfIngredients.Count; _listOfIngredients.Remove(ingredient); if (initialCount > _listOfIngredients.Count) { return(true); } else { return(false); } }
//Create public void AddIngredient(IngredientsContent content) { _listOfIngredients.Add(content); }