private void CreateMenuItem()
        {
            Menu newMenuItem = new Menu();

            Console.WriteLine("What price would you want the item to be?(No $ needed)");
            newMenuItem.ItemPrice = decimal.Parse(Console.ReadLine());
            Console.WriteLine("What title would you like to use for the menu item?");
            newMenuItem.ItemTitle = Console.ReadLine();
            Console.WriteLine("What description would you give the menu item?");
            newMenuItem.ItemDescription = Console.ReadLine();
            newMenuItem.IngredientList  = AddIngredient();

            _menuRepo.AddItemToList(newMenuItem);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Menu meal1 = new Menu(1, "Pancakes", "Golden flapjacks served with side options of fruit, sausages, eggs, and coffee. Complimentary orange juice.", "Ingredients: flour, baking powder, milk, eggs, sugar, salt, unsalted butter, vegetable oil, assorted toppings: butter, maple syrup, confectioner's sugar, honey, jams, preserves, whipped cream.", 4.99m);
            Menu meal2 = new Menu(2, "Waffles", "Crispy, fluffy waffles fresh from the waffle iron served with side options of fruit, sausages, eggs, and coffee. Complimentary orange juice.", "Ingredients: eggs, flour, milk, vegetable oil, sugar, baking powder, salt, vanilla extract, assorted toppings: butter, maple syrup, confectioner's sugar, honey, jams, preserves, whipped cream.", 4.99m);
            Menu meal3 = new Menu(3, "Crepes", "Thin French pastries served sweet or savory with side options of fruit, sausages, eggs, and coffee. Complimentary orange juice.", "Ingredients: flour, salt, eggs, sugar, whole milk, unsalted butter. Sweet: add vanilla extract, fill with jam, honey, sugar, chocolate hazelnut spread, peanut butter, bananas, etc. Savory: no vanilla extract, fill with shrimp or chicken or bacon with assorted vegetables and herbs.", 6.99m);
            Menu meal4 = new Menu(4, "French Toast", "Bread slices soaked in eggs and milk, and then fried. Served with side options of fruit, sausages, eggs, and coffee. Complimentary orange juice.", "Ingredients: eggs, vanilla extract, nutmeg, bread, vegetable oil, milk, cinnamon, salt, unsalted butter, assorted toppings: butter, maple syrup, confectioner's sugar, honey, jams, preserves, whipped cream.", 5.99m);
            Menu meal5 = new Menu(5, "Oatmeal", "Whole oat grains mixed with your choice of fruit, served with side options of fruit, sausages, eggs, and coffee. Complimentary orange juice.", "Ingredients: whole grain oats, milk, salt, water, honey.", 3.99m);

            MenuRepository menuRepo = new MenuRepository();

            menuRepo.AddItemToList(meal1);
            menuRepo.AddItemToList(meal2);
            menuRepo.AddItemToList(meal3);
            menuRepo.AddItemToList(meal4);
            menuRepo.AddItemToList(meal5);

            List <Menu> meals = menuRepo.GetList();

            while (true)
            {
                Console.WriteLine("Enter the NUMBER you would like to select:\n" +
                                  "1. List all menu items.\n" +
                                  "2. Add a menu item. \n" +
                                  "3. Remove a menu item. \n" +
                                  "4. Exit Console. \n");

                string optionAsString = Console.ReadLine();
                int    option         = int.Parse(optionAsString);

                if (option == 1)
                {
                    foreach (Menu meal in meals)
                    {
                        Console.WriteLine($"Meal Name: {meal.MealName}\n" +
                                          $"Menu Number: {meal.MealNumber}\n" +
                                          $"Meal Description: {meal.MealDescription}\n" +
                                          $"Meal Ingredients: {meal.MealListOfIngredients}\n" +
                                          $"Meal Price: {meal.MealPrice} \n");
                    }
                }

                if (option == 2)
                {
                    while (true)
                    {
                        Console.WriteLine("Enter a meal number: ");
                        int mealnumber = int.Parse(Console.ReadLine());
                        Console.WriteLine("Enter a meal name: ");
                        string mealname = Console.ReadLine();
                        Console.WriteLine("Enter a meal description: ");
                        string mealdescription = Console.ReadLine();
                        Console.WriteLine("Enter the meal ingredients: ");
                        string mealingredients = Console.ReadLine();
                        Console.WriteLine("Enter a meal price: ");
                        decimal mealprice = decimal.Parse(Console.ReadLine());

                        Menu userMeal = new Menu(mealnumber, mealname, mealdescription, mealingredients, mealprice);
                        menuRepo.AddItemToList(userMeal);

                        Console.WriteLine("\n Would you like to add another meal item? y/n");
                        string response = Console.ReadLine();
                        response = response.ToLower();
                        if (response == "y")
                        {
                        }
                        else if (response == "n")
                        {
                            break;
                        }
                    }
                }

                if (option == 3)
                {
                    while (true)
                    {
                        Console.WriteLine("What meal would you like to remove? Enter a NUMBER:");
                        int number = int.Parse(Console.ReadLine());
                        menuRepo.RemoveItemFromList(number);


                        Console.WriteLine("Do you want to delete another item? y/n");
                        string response = Console.ReadLine();
                        response = response.ToLower();
                        if (response == "y")
                        {
                        }
                        else if (response == "n")
                        {
                            break;
                        }
                    }
                }

                if (option == 4)
                {
                    break;
                }
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Menu Strawberry = new Menu(1, "StrawberryCake", "real fruit goodness", "cake mix, strawberry", 5);
            Menu Chocolate  = new Menu(2, "ChocolateCake", "lava cake", "cake mix, chocolate", 2);
            Menu Birthday   = new Menu(3, "BirthdayCake", "celebrate your day", "sprinkles, cake mix", 4);

            MenuRepository menuRepo = new MenuRepository();

            while (true)
            {
                Console.WriteLine("What do you want to do? Pick a number.\n" +
                                  "1) Add to List.\n" +
                                  "2) View List.\n" +
                                  "3). Remove from List.");
                string userAnswer = Console.ReadLine();

                if (userAnswer == "1")
                {
                    Console.WriteLine("Enter the number of cake:");
                    int cakenumber = int.Parse(Console.ReadLine());
                    Console.WriteLine("Enter name of cake");
                    string cakename = Console.ReadLine();
                    Console.WriteLine("Enter the description of the cake:");
                    string cakescription = Console.ReadLine();
                    Console.WriteLine("Enter the ingredients used to make this cake:");
                    string cakegredients = Console.ReadLine();
                    Console.WriteLine("Enter the cost of this cake");
                    int cakecost = int.Parse(Console.ReadLine());

                    Menu usercake = new Menu(cakenumber, cakename, cakescription, cakegredients, cakecost);

                    menuRepo.AddItemToList(usercake);
                }

                if (userAnswer == "2")
                {
                    menuRepo.AddItemToList(Strawberry);
                    menuRepo.AddItemToList(Chocolate);
                    menuRepo.AddItemToList(Birthday);

                    List <Menu> cakes = menuRepo.GetList();

                    Console.WriteLine("Press enter to view the menu list:");

                    Console.ReadLine();

                    foreach (Menu cake in cakes)
                    {
                        Console.WriteLine($"Meal Number: {cake.Number}\n" +
                                          $"Name: {cake.Name}\n" +
                                          $"Description: {cake.Description}\n" +
                                          $"Ingredients: {cake.Ingredients}\n" +
                                          $"Price: {cake.Price}\n");
                    }
                }

                if (userAnswer == "3")
                {
                    while (true)
                    {
                        Console.WriteLine("Would you like to delete a cake off the menu?");
                        string theAnswer = Console.ReadLine();
                        if (theAnswer == "y")
                        {
                            Console.WriteLine("What cake you want to remove?");
                            string Name = Console.ReadLine();

                            menuRepo.RemoveItemFromList(Name);
                        }
                        if (theAnswer == "n")
                        {
                            break;
                        }
                    }
                }
                Console.ReadLine();
            }
        }