예제 #1
0
        public bool UpdateCurrentMenuItem(string originalMealNumber, ChallengeOneMenuProperties newMealNumber)
        {
            ChallengeOneMenuProperties oldMealNumber = FindSpecificMenuItem(int.Parse(originalMealNumber));

            if (oldMealNumber != null)
            {
                oldMealNumber.MealName       = newMealNumber.MealName;
                oldMealNumber.Description    = newMealNumber.Description;
                oldMealNumber.IngredientList = newMealNumber.IngredientList;
                oldMealNumber.MealNumber     = newMealNumber.MealNumber;
                oldMealNumber.Price          = newMealNumber.Price;
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        public bool RemoveMenuItem(int mealNumber)
        {
            ChallengeOneMenuProperties menuItem = FindSpecificMenuItem(mealNumber);

            if (menuItem == null)
            {
                return(false);
            }
            int initialCount = menuItems.Count;

            menuItems.Remove(menuItem);

            if (initialCount > menuItems.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
 public void AddNewMenuItem(ChallengeOneMenuProperties menuItem)
 {
     menuItems.Add(menuItem);
 }