public void PrintAllMenuItemswithDetails() { foreach (var item in _menuRepo.GetList()) { Console.WriteLine($"Meal Name: {item.Name} \n" + $"Meal Number: {item.Number} \n" + $"Description: {item.Description} \n" + $"Ingredients: {item.Ingredients} \n" + $"Price: {item.Price} \n"); } Console.ReadLine(); }
private void DisplayList() { tempList = menuRepo.GetList(); foreach (MenuClasses item in tempList) { Console.WriteLine(item); } Console.ReadLine(); InitialPrompt(); }
public static void ViewOptionSimple() { Console.WriteLine(divider); Console.WriteLine("Komodo Cafe Menu: "); int counter = 1; foreach (MenuItem menu_item in MenuRepository.GetList()) { Console.WriteLine($" #{counter}: {menu_item.Name} | 1 @ ${menu_item.Price}"); counter++; } Input("\nPress enter/return when you're done reading the menu "); }
public static void RemoveOption() { Console.WriteLine(divider); Console.WriteLine("Choose a menu item: "); int counter = 1; foreach (MenuItem menu_item in MenuRepository.GetList()) { Console.WriteLine($" [{counter}] {menu_item.Name}"); counter++; } Console.WriteLine($" [{counter}] Cancel"); while (true) { int chosen_num = int.Parse(Input("Input [#]: ")) - 1; if (chosen_num + 1 == counter) { return; } if (chosen_num > MenuRepository.GetList().Count || chosen_num < 0) { continue; } MenuItem removed_item = MenuRepository.GetList()[chosen_num]; MenuRepository.RemoveMenuItem(removed_item); Console.WriteLine(divider); Console.WriteLine($"{removed_item.Name} has been removed."); Input("Press enter/return "); return; } }
public static void ViewOptionVerbose() { Console.WriteLine(divider); Console.WriteLine("Komodo Cafe Menu: "); int counter = 1; foreach (MenuItem menu_item in MenuRepository.GetList()) { Console.WriteLine($" #{counter}: {menu_item.Name} | 1 @ ${menu_item.Price}"); Console.WriteLine($" \"{menu_item.Description}\""); Console.WriteLine($"\n Ingredients: "); foreach (string ingredient in menu_item.Ingredients) { Console.WriteLine($" {ingredient}"); } Console.WriteLine(); counter++; } Input("Press enter/return when you're done reading the menu "); }
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; } } }
public static void ChooseAnOption() { while (true) { Console.WriteLine(divider); Console.WriteLine("What would you like to do?"); Console.WriteLine(" [1] Add a menu item"); Console.WriteLine(" [2] Remove a menu item"); Console.WriteLine(" [3] View menu"); Console.WriteLine(" [4] View menu (verbose)"); Console.WriteLine(" [5] Exit program"); while (true) { string choice = Input("Input [#]: "); if (choice == "1") { AddOption(); break; } if (choice == "2") { if (MenuRepository.GetList().Count > 0) { RemoveOption(); } else { Console.WriteLine(divider); Console.WriteLine("You have no menu items yet."); Input("Press enter/return "); } break; } if (choice == "3") { if (MenuRepository.GetList().Count > 0) { ViewOptionSimple(); } else { Console.WriteLine(divider); Console.WriteLine("You have no menu items yet."); Input("Press enter/return "); } break; } if (choice == "4") { if (MenuRepository.GetList().Count > 0) { ViewOptionVerbose(); } else { Console.WriteLine(divider); Console.WriteLine("You have no menu items yet."); Input("Press enter/return "); } break; } if (choice == "5") { Environment.Exit(1); } } } }
static void Main(string[] args) { //Identify Variables MenuItems salad = new MenuItems(1, "Salad", "Cesar Salad", "Lettuce, tomato, cheese, onion, cesar dressing", 4.99); MenuRepository menuRepo = new MenuRepository(); menuRepo.AdditemToMenu(salad); MenuItems chilli = new MenuItems(2, "Chilli", "Red Pepper Chilli", "Cooked ground beef, chilli sauce, red peppers", 2.99); MenuItems cheeseBurger = new MenuItems(3, "Cheeseburger", "ultimate Cheeseburger", "Hamburger bun, two patties, two slices of American cheese, lettuce, ketchup", 8.99); MenuItems hotDog = new MenuItems(4, "Hot Dog", "Hotdog on a hotdog bun", "One cooked hotdog on a hotdog bun with your choice of ketchup or mustard", 2.99); MenuItems banannaPudding = new MenuItems(5, "Pudding", "Bananna Pudding", "Pudding, banannas, vanilla wafers", 3.99); menuRepo.AdditemToMenu(chilli); menuRepo.AdditemToMenu(cheeseBurger); menuRepo.AdditemToMenu(hotDog); menuRepo.AdditemToMenu(banannaPudding); List <MenuItems> items = menuRepo.GetList(); foreach (MenuItems menuItems in items) { Console.WriteLine(menuItems.MealName); } Console.WriteLine(" "); menuRepo.RemoveitemsFromList(chilli); Console.WriteLine("Enter meal #"); int number = Int32.Parse(Console.ReadLine()); foreach (MenuItems menuItem in items) { Console.WriteLine($"MealName: {menuItem.MealName}\n" + $"Meal Number :{menuItem.MealNumber} \n" + $"Description: {menuItem.Description} \n" + $"Ingredients: {menuItem.Ingredients}\n" + $"Price: {menuItem.Price}\n"); } Console.WriteLine("Enter name of food item:"); string userAnswer = Console.ReadLine(); Console.WriteLine("Enter meal number"); int userMealNumber = Int32.Parse(Console.ReadLine()); Console.WriteLine("Enter description:"); string userDescription = Console.ReadLine(); Console.WriteLine("Enter ingredients:"); string userIngredients = Console.ReadLine(); Console.WriteLine("Enter price of food item:"); double userPrice = Double.Parse(Console.ReadLine()); MenuItems theItem = new MenuItems(userMealNumber, userAnswer, userDescription, userIngredients, userPrice); menuRepo.AdditemToMenu(theItem); }
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(); } }