Ejemplo n.º 1
0
 public void ShowMeal(C1MenuItems menuItem)
 {
     Console.WriteLine($"Meal #: {menuItem.MealNum}");
     Console.WriteLine($"Meal Name: {menuItem.MealName}");
     Console.WriteLine($"Description: {menuItem.Description}");
     Console.WriteLine($"Meal Price: {menuItem.Price}");
     Console.WriteLine($"Ingredients: {menuItem.Ingredients}");
 }
Ejemplo n.º 2
0
        public bool AddMenuItemToMenu(C1MenuItems newItem)
        {
            int startingCount = menuItems.Count;

            menuItems.Add(newItem);
            bool wasAdded = (menuItems.Count > startingCount) ? true : false;

            return(wasAdded);
        }
Ejemplo n.º 3
0
        public void ShowMenuItemByNumber()
        {
            Console.Clear();
            Console.WriteLine("Enter the number of the menu item you'd like to see.");
            int         mealNum  = Int32.Parse(Console.ReadLine());
            C1MenuItems menuItem = GetMenuItemByNumber(mealNum);

            if (menuItem != null)
            {
                ShowMeal(menuItem);
            }
            else
            {
                Console.WriteLine("That title doesn't exist.");
            }
            Console.ReadKey();
        }
Ejemplo n.º 4
0
        public void DeleteMenuItemByNumber()
        {
            Console.Clear();
            ShowMenuItems();
            Console.WriteLine("Enter the number for the menu item you would like to delete.");
            var         menuItemToDelete = Int32.Parse(Console.ReadLine());
            C1MenuItems numToDelete      = GetMenuItemByNumber(menuItemToDelete);
            bool        wasDeleted       = DeleteExistingMenuItem(numToDelete);

            if (wasDeleted)
            {
                Console.WriteLine("This content was successfully deleted.");
            }
            else
            {
                Console.WriteLine("Content could not be deleted");
            }
        }
Ejemplo n.º 5
0
        public void CreateNewMenuItems()
        {
            Console.Clear();
            //CreateNewMenuItems new
            C1MenuItems newMenuItem = new C1MenuItems();

            // ask for and take user input for new menu item
            Console.WriteLine("Please enter a menu item number.");
            newMenuItem.MealNum = Int32.Parse(Console.ReadLine());
            Console.WriteLine("Please enter a meal name.");
            newMenuItem.MealName = Console.ReadLine();
            Console.WriteLine("Please enter a meal description.");
            newMenuItem.Description = Console.ReadLine();
            Console.WriteLine("Please enter a price for this meal.");
            string priceAsString = Console.ReadLine();
            double priceAsDouble = double.Parse(priceAsString);

            newMenuItem.Price = priceAsDouble;
            Console.WriteLine("Please enter a list of ingredients.");
            newMenuItem.Ingredients = Console.ReadLine();
            AddMenuItemToMenu(newMenuItem);
        }
Ejemplo n.º 6
0
        public bool DeleteExistingMenuItem(C1MenuItems existingMenuItem)
        {
            bool deleteResult = menuItems.Remove(existingMenuItem);

            return(deleteResult);
        }