public void Run() { _menuItems = _menuRepo.ProduceMenu(); SeedData(); while (_response != 4) { PrintMenu(); switch (_response) { case 1: Console.WriteLine("Meal name: "); string mealName = Console.ReadLine(); Console.WriteLine("\nMeal description: "); var description = Console.ReadLine(); Console.WriteLine("\nMeal price: "); decimal price = decimal.Parse(Console.ReadLine()); bool ingredientsLoop = true; List <string> ingredientsFromConsole = new List <string>(); while (ingredientsLoop) { Console.WriteLine("Name an ingredient: "); var ingredient = Console.ReadLine(); ingredientsFromConsole.Add(ingredient); Console.WriteLine("Would you like to add another ingredient? y/n"); var addIngredientResponse = Console.ReadLine().ToLower(); if (addIngredientResponse.Contains("n")) { ingredientsLoop = false; } } string ingredients = _menuRepo.IngredientsToString(ingredientsFromConsole); _menuRepo.AddItemToMenu(new MenuItem(mealName, description, ingredients, price)); break; case 2: PrintMeals(); Console.WriteLine("Which item number should be removed?"); var removalNum = int.Parse(Console.ReadLine()); _menuRepo.RemoveItemFromMenu(_menuItems[removalNum - 1]); break; case 3: PrintMeals(); break; } Console.WriteLine("Press any key to return to menu..."); Console.ReadKey(); Console.Clear(); } }
private void CreateSeedMenu() { List <string> ingsList = new List <string>(); ingsList.Add("patty"); ingsList.Add("buns"); Menu item1 = new Menu(1, "Hamburger", "A patty between two buns", ingsList, 8.75m); Menu item2 = new Menu(2, "Cheeseburger", "A patty between two buns", ingsList, 9.75m); Menu item3 = new Menu(3, "Turkey Burger", "A patty between two buns", ingsList, 10.75m); _menuRepo.AddItemToMenu(item1); _menuRepo.AddItemToMenu(item2); _menuRepo.AddItemToMenu(item3); }
private void CreateMenuItem() { Menu menu = new Menu(); Console.WriteLine("Enter meal name:"); menu.MealName = Console.ReadLine(); Console.WriteLine("Enter meal description:"); menu.MealDescription = Console.ReadLine(); menu.MealIngredients = AddIngredients(); Console.WriteLine("Set price of meal:"); menu.MealPrice = int.Parse(Console.ReadLine()); _menuRepository.AddItemToMenu(menu); Console.Clear(); }
public void AddItemsToMenu() { Console.Clear(); MenuContent newContent = new MenuContent(); Console.WriteLine("What number do you wish to assign This meal?"); newContent.MealNumber = int.Parse(Console.ReadLine()); Console.WriteLine("\nWhat is the name of this meal?"); newContent.MealName = Console.ReadLine(); Console.WriteLine("\nPlease provide a description of the meal"); newContent.Description = Console.ReadLine(); Console.WriteLine("\nPLease add a list of ingredients used in the dish."); newContent.Ingredients = Console.ReadLine(); _menuRepo.AddItemToMenu(newContent); }
private void CreateMenu() { Menu newContent = new Menu(); Console.WriteLine("Enter Item Number: "); newContent.MenuNumber = int.Parse(Console.ReadLine()); Console.WriteLine("Enter Item Name: "); newContent.MenuName = Console.ReadLine(); Console.WriteLine("Enter Item Description: "); newContent.Description = Console.ReadLine(); Console.WriteLine("Enter Item Ingredients: "); newContent.Ingredients = Console.ReadLine(); Console.WriteLine("Enter Item Price: "); newContent.Price = decimal.Parse(Console.ReadLine()); _menuRepo.AddItemToMenu(newContent); }
private void NewMenuItem() { Console.WriteLine("What will be the Menu Number?"); int num = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Please give a name to the menu Item:"); string name = Console.ReadLine(); Console.WriteLine("Please give a short description of the Item"); string description = Console.ReadLine(); Console.WriteLine("Please add the ingredients for this Item"); string ingredients = Console.ReadLine(); Console.WriteLine("Please List the Price for this Item"); double price = Convert.ToDouble(Console.ReadLine()); MenuClasses newItem = new MenuClasses(num, name, description, ingredients, price); menuRepo.AddItemToMenu(newItem); InitialPrompt(); }
private void CreateMenuItem() { Console.Clear(); Menu newItem = new Menu(); Console.WriteLine("What is the desired meal number?"); newItem.Number = int.Parse(Console.ReadLine()); Console.WriteLine("\nWhat would you like to call this meal?"); newItem.Name = Console.ReadLine(); Console.WriteLine("\nPlease entere a meal description."); newItem.Description = Console.ReadLine(); Console.WriteLine("\nPlease enter all of the ingredients for your meal."); newItem.IngredientList = Console.ReadLine(); Console.WriteLine("\nWhat is your desired meal price? \n(Please match this format; 5.99)"); newItem.Price = double.Parse(Console.ReadLine()); _menuRepo.AddItemToMenu(newItem); }
public void Run() { _menuItems = _menuRepo.GetMenuItemList(); while (_response != 4) { PrintMenu(); switch (_response) { case 1: Console.WriteLine("Meal name: "); var mealName = Console.ReadLine(); Console.WriteLine("\nMeal description: "); var description = Console.ReadLine(); Console.WriteLine("\nMeal price: "); var price = decimal.Parse(Console.ReadLine()); var isAddingIngredients = true; var ingredientsFromConsole = new List <string>(); while (isAddingIngredients) { Console.WriteLine("Name an ingredient: "); var ingredient = Console.ReadLine(); ingredientsFromConsole.Add(ingredient); try { Console.WriteLine("Would you like to add another ingredient? y/n"); var addIngredientResponse = Console.ReadLine().ToLower(); if (!addIngredientResponse.Contains("n") && !addIngredientResponse.Contains("y")) { throw new ArgumentException("Please enter \"n\" or \"y\"."); } if (addIngredientResponse == "n") { isAddingIngredients = false; } } catch (Exception ex) { Console.WriteLine(ex.Message); } } string ingredients = _menuRepo.IngredientsToString(ingredientsFromConsole); _menuRepo.AddItemToMenu(new MenuItem(mealName, description, ingredients, price)); break; case 2: PrintMeals(); Console.WriteLine("Which item number should be removed?"); var removalNum = int.Parse(Console.ReadLine()); _menuRepo.RemoveItemFromMenu(_menuItems[removalNum - 1]); break; case 3: PrintMeals(); break; } Console.WriteLine("Press any key to return to menu..."); Console.ReadKey(); Console.Clear(); } }
public void AddItemToMenu(CafeMenu item) { _menuRepo.AddItemToMenu(item); }
static void Main(string[] args) { MenuRepository menuList = new MenuRepository(); List <MenuItem> menuItems = menuList.ProduceMenu(); MenuItem arrozConPollo = new MenuItem(1, "Arroz con Pollo", "Mexican rice with grilled chicken and white cheese.", "Rice, Chicken, Cheese, Spices.", 12.0m); MenuItem macNCheese = new MenuItem(2, "Mac N' Cheese", "Kraft macaroni and cheese", "Macaroni pasta, milk, butter, powdered cheese mix.", 1.50m); MenuItem hambuger = new MenuItem(3, "Flame-grilled Hamburger", "Delicious burger grilled over open flame lightly seasoned.", "Ground beef, brioche bun, sal, pepper, rosemary, butter.", 14.0m); menuList.AddItemToMenu(arrozConPollo); menuList.AddItemToMenu(macNCheese); menuList.AddItemToMenu(hambuger); string response = "0"; while (response != "4") { Console.WriteLine($"Menu Options \n 1. Add Menu Item \n 2. Remove Menu Item \n 3. Print Menu \n 4. Finish"); response = Console.ReadLine(); Console.Clear(); if (response == "1") { Console.Clear(); Console.WriteLine("Menu item number: "); var number = Console.ReadLine(); var mealNum = Int32.Parse(number); Console.WriteLine("Meal name: "); string mealName = Console.ReadLine(); Console.WriteLine("Meal description: "); var description = Console.ReadLine(); Console.WriteLine("Meal price: "); string priceString = Console.ReadLine(); decimal price = decimal.Parse(priceString); bool ingredientsLoop = true; List <String> _ingredientsFromConsole = new List <string>(); while (ingredientsLoop) { Console.WriteLine("Name an ingredient: "); var ingredient = Console.ReadLine(); _ingredientsFromConsole.Add(ingredient); Console.WriteLine("Would you like to add another ingredient? y/n"); var addIngredientResponse = Console.ReadLine(); if (addIngredientResponse == "n") { ingredientsLoop = false; } } StringBuilder builder = new StringBuilder(); foreach (string ingredient in _ingredientsFromConsole) { builder.Append(ingredient).Append(", "); } builder.Length -= 2; string result = builder.ToString(); MenuItem newMenuItem = new MenuItem() { MealNumber = mealNum, MealName = mealName, Description = description, Ingredients = result, MealPrice = price }; menuList.AddItemToMenu(newMenuItem); Console.Clear(); } else if (response == "2") { Console.Clear(); Console.WriteLine("Which item number should be removed?"); var removalNum = Int32.Parse(Console.ReadLine()); foreach (MenuItem meal in menuItems) { if (meal.MealNumber == removalNum) { menuList.RemoveItemFromMenu(meal); break; } } Console.Clear(); } else if (response == "3") { foreach (MenuItem meal in menuItems) { Console.WriteLine($"Menu item: {meal.MealName} \n Meal Number: {meal.MealNumber} \n Description: {meal.Description} \n Ingredients: {meal.Ingredients} \n Price: {meal.MealPrice}"); } Console.WriteLine("Press 'Enter' to return to menu."); Console.ReadLine(); Console.Clear(); } } }