Пример #1
0
        private void UpdateMenuItem()
        {
            Console.Clear();
            ShowMenuItemNameandNumber();
            Console.Write("\n\tEnter the number of the Menu Item you would like to update:\n" +
                          "\n\t # ");
            int oldItem = Convert.ToInt32(Console.ReadLine());

            Console.Clear();
            MenuItem newItem = new MenuItem();

            //number
            Console.Write("\n\tEnter Menu Number: # ");
            newItem.MealNumber = Convert.ToInt32(Console.ReadLine());
            //name
            Console.Write("\n\tEnter Meal Name: ");
            newItem.MealName = (Console.ReadLine());
            //descrip
            Console.Write("\n\tEnter Meal Desription:\n" +
                          "\n\t");
            newItem.MealDescription = (Console.ReadLine());
            //ingr
            Console.Write("\n\tEnter Meal Ingredients:\n" +
                          "\n\t");
            newItem.Ingredients = (Console.ReadLine());
            //price
            Console.Write("\tEnter Meal Price: $ ");
            newItem.Price = Convert.ToDouble(Console.ReadLine());

            bool wasAddedCorrectly = _repo.UpdateMenuItemByNumber(oldItem, newItem);

            if (wasAddedCorrectly)
            {
                Console.WriteLine("\n\tThe Meal was updated");
            }
            else
            {
                Console.WriteLine("\n\tCould not update the Meal.");
            }
        }