public static void AddFoodItem(FoodsMenu foodsMenu) { Console.WriteLine($"You have chosen to add a food"); string item = AskForMenuItem($"Enter food name: "); double price = AskForMenuItemPrice($"Enter price for {item}: "); string[] newArray = new string[(foodsMenu.Foods.Length + 1)]; int i = 0; foreach (string menuItem in foodsMenu.Foods) { newArray[i] = menuItem; i++; } while (item.Length < 15) { item = item + " "; } string foodItem = $"{item} - {price}"; newArray[i] = foodItem; foodsMenu.Foods = newArray; JsonManager.SaveData <FoodsMenu>(foodsMenu, "FoodsMenu", "Menu"); Console.WriteLine($"{foodItem} added"); }
static void AdminMenu() { while (true) { Console.Clear(); Console.Write( "\n\nAdmin options:\n" + "\t1 - Show list of escape rooms\n" + "\t2 - Add escape room\n" + "\t3 - Edit escape room\n" + "\t4 - Remove escape room\n" + "\t5 - Edit information panel\n" + "\t6 - Manage foods and beverages\n" + "\t= - Back\n" + "Your option? " ); switch (Console.ReadLine()) { case "=": return; case "1": Console.Clear(); EscapeRoomController.ShowRooms(); PressEnterToContinueInConsole(); break; case "2": Console.Clear(); EscapeRoomController.CreateRoom(); PressEnterToContinueInConsole(); break; case "3": Console.Clear(); EscapeRoomController.EditRoom(); PressEnterToContinueInConsole(); break; case "4": Console.Clear(); EscapeRoomController.DeleteRoom(); PressEnterToContinueInConsole(); break; case "5": Console.Clear(); Information.EditInfo(); break; case "6": Console.Clear(); FoodsMenu.MenuForFoodsMenu(); break; } } }
public static void Menu() { while (true) { Console.Clear(); Console.WriteLine("Welcome to Escap, The place to visit for your escape room needs"); Console.Write( "\n\nChoose an option from the following list:\n" + "\t1 - Show current escape rooms\n" + "\t2 - Show Food Menu\n" + "\t3 - Book a escape room\n" + "\t4 - Information about our company\n" + "\t- - Admin options (Employees only!)\n" + "\t= - Exit\n" + "Your option? " ); // Menu options switch (Console.ReadLine()) { case "=": return; case "1": Console.Clear(); EscapeRoomController.ShowRooms(); PressEnterToContinueInConsole(); break; case "2": Console.Clear(); FoodsMenu.DisplayMenu(); PressEnterToContinueInConsole(); break; case "3": Console.Clear(); EscapeRoomReservation.Menu();; PressEnterToContinueInConsole(); break; case "4": Console.Clear(); Information.ShowInfo(); PressEnterToContinueInConsole(); break; case "-": LoggingIn(); Console.Clear(); break; } } }
public static void RemoveBeverageItem(FoodsMenu foodsMenu) { Console.Clear(); Console.WriteLine("Removing beverage item: "); int i = 1; foreach (string item in foodsMenu.Beverages) { Console.WriteLine($"\t{i} : {item}"); i++; } Console.WriteLine("\nChoose number you want to delete: "); int awnser = Int32.Parse(Console.ReadLine()) - 1; foodsMenu.Beverages = foodsMenu.Beverages.Where(val => val != foodsMenu.Beverages[awnser]).ToArray(); JsonManager.SaveData <FoodsMenu>(foodsMenu, "FoodsMenu", "Menu"); Console.WriteLine("Beverage removed"); }