Beispiel #1
0
        //Update
        public bool UpdateMenuItem(int originalMealNumber, CafeContent newCafeContent)
        {
            CafeContent oldCafeContent = GetMenuByID(originalMealNumber);

            if (oldCafeContent != null)
            {
                oldCafeContent.MealNumber        = newCafeContent.MealNumber;
                oldCafeContent.MealName          = newCafeContent.MealName;
                oldCafeContent.Description       = newCafeContent.Description;
                oldCafeContent.ListOfIngredients = newCafeContent.ListOfIngredients;
                oldCafeContent.Price             = newCafeContent.Price;
                return(true);
            }
            else
            {
                return(false);
            }

            int initialCount = _menuItems.Count;

            _menuItems.Remove(oldCafeContent);

            if (initialCount > _menuItems.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        //Delete
        public bool RemoveMenuItem(int mealNumber)
        {
            CafeContent cafeContent = GetMenuByID(mealNumber);

            if (cafeContent == null)
            {
                return(false);
            }

            int initialCount = _menuItems.Count;

            _menuItems.Remove(cafeContent);

            if (initialCount > _menuItems.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
 //Create
 public void AddMenuItem(CafeContent content)
 {
     _menuItems.Add(content);
 }