Example #1
0
        //Update
        public bool UpdateExistingMeal(int originalMealNumber, KomodoMenu newMeal)
        {
            //Find the meal
            KomodoMenu oldMeal = GetMealByMealNumber(originalMealNumber);

            //Update the meal
            if (oldMeal != null)
            {
                oldMeal.MealNumber        = newMeal.MealNumber;
                oldMeal.MealName          = newMeal.MealName;
                oldMeal.MealDescription   = newMeal.MealDescription;
                oldMeal.ListOfIngredients = newMeal.ListOfIngredients;
                oldMeal.MealPrice         = newMeal.MealPrice;
                oldMeal.TypeOfFood        = newMeal.TypeOfFood;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        //Delete
        public bool RemoveMealFromList(int mealNumber)
        {
            KomodoMenu meal = GetMealByMealNumber(mealNumber);

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

            int initialCount = _listOfMeals.Count;

            _listOfMeals.Remove(meal);

            if (initialCount > _listOfMeals.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
 //Create
 public void AddMealToList(KomodoMenu meal)
 {
     _listOfMeals.Add(meal);
 }