//update
        public bool UpdateMenu(int originalMealNum, Cafe NewMealNum)
        {
            //find
            Cafe oldMealNum = GetMenuByNum(originalMealNum);

            //update
            if (oldMealNum != null)
            {
                oldMealNum.MealNum     = NewMealNum.MealNum;
                oldMealNum.Price       = NewMealNum.Price;
                oldMealNum.MealName    = NewMealNum.MealName;
                oldMealNum.Description = NewMealNum.Description;
                oldMealNum.Ingredients = NewMealNum.Ingredients;
                return(true);
            }
            else
            {
                return(false);
            }
        }
        //U
        public bool UpdateExisitingMenuItem(int menuId, Cafe updatedItem)
        {
            //find item
            Cafe itemToUpdate = GetMenuByNumber(menuId);

            //update menu item
            if (itemToUpdate != null)
            {
                itemToUpdate.MealNumber  = updatedItem.MealNumber;
                itemToUpdate.MealName    = updatedItem.MealName;
                itemToUpdate.Description = updatedItem.Description;
                itemToUpdate.Ingredinets = updatedItem.Ingredinets;
                itemToUpdate.Price       = updatedItem.Price;

                return(true);
            }
            else
            {
                return(false);
            }
        }
        //Delete
        public bool RemoveFoodItem(int mealNum)
        {
            Cafe foodItem = GetMenuByNum(mealNum);

            if (foodItem == null)
            {
                return(false);
            }
            int intialCount = _cafemenu.Count;

            _cafemenu.Remove(foodItem);

            if (intialCount > _cafemenu.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        //D
        public bool RemoveItemFromList(int mealNumber)
        {
            Cafe itemToDelete = GetMenuByNumber(mealNumber);

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

            int intialcount = _listOfCafe.Count;

            _listOfCafe.Remove(itemToDelete);

            if (intialcount > _listOfCafe.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #5
0
        //Update
        //note says we don't need to update right now??

        //Delete
        public bool RemoveItemFromCafe(int itemNum)
        {
            Cafe item = GetItemByNumber(itemNum);

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

            int initialCount = _listOfCafeItems.Count;

            _listOfCafeItems.Remove(item);

            if (initialCount > _listOfCafeItems.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 //C
 public void AddNewMenuItems(Cafe newMenuItem)
 {
     _listOfCafe.Add(newMenuItem);
 }
Exemple #7
0
 //CRUD METHODS HELD HERE
 //Create
 public void AddItemToCafe(Cafe item)
 {
     _listOfCafeItems.Add(item);
 }
 //Create
 public void AddMeal(Cafe FoodItem)
 {
     _cafemenu.Add(FoodItem);
 }