Exemple #1
0
        private void RemoveDish()
        {
            Console.WriteLine("Select menu that you wish to delete a dish from:");
            PrintMenuName();
            int  menuNumber = ReadInt("Your Selection:", 1, restaurant.MenuCount);
            Menu menu       = restaurant.Menus[menuNumber - 1];

            if (menu.DishCount == 0)
            {
                Console.WriteLine("This menu has no dishes to be removed!");
                return;
            }

            Console.WriteLine("Select category that you wish to delete a dish from:");
            PrintStrings(menu.GetNamesOfCategories());
            int categoryInt = ReadInt("Your Selection:",
                                      1, Enum.GetNames(typeof(Menu.Category)).Length);

            Menu.Category  category     = (Menu.Category)categoryInt;
            MenuCategories menuCategory = menu.Categories[categoryInt - 1];

            if (menuCategory.Dishes.Count == 0)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Removing dish failed because category is empty!");
                Console.ResetColor();
                return;
            }

            PrintStrings(menu.GetNamesOfDishes(category));
            int dishNumber = ReadInt("Select the ID number of dish to be removed:", 1, menu.DishCount);

            menu.RemoveDish(category, dishNumber - 1);
        }
Exemple #2
0
        private void AddNewDish()
        {
            Console.WriteLine("Select menu for this dish to be added in:");
            PrintMenuName();
            int  menuNumber = ReadInt("Your selestion:", 1, restaurant.MenuCount);
            Menu menu       = restaurant.Menus[menuNumber - 1];

            Console.WriteLine("Choose category for this dish:");
            PrintStrings(menu.GetNamesOfCategories());
            int categoryInt = ReadInt("Category chosen:",
                                      1, Enum.GetNames(typeof(Menu.Category)).Length) - 1;

            Menu.Category category = (Menu.Category)categoryInt;

            Console.WriteLine("Name of this dish:");
            string name = Console.ReadLine();

            Console.WriteLine("Short description of this dish:");
            string description = Console.ReadLine();

            double price = ReadDouble("Price of this dish:");


            menu.AddDish(category, name, description, price);
        }
Exemple #3
0
 public MenuCategory(Menu.Category id, Dish dish) :
     this(id)
 {
     AddDish(dish);
 }
Exemple #4
0
 public MenuCategory(Menu.Category id)
 {
     this.CatId = id;
     this.Id    = (int)id;
     this.Name  = id.ToString();
 }