public void GetCustomers() { Console.WriteLine("Enter your full name"); string name = Console.ReadLine(); var customers = _customerBL.GetCustomersByName(name); if (customers.Any()) { if (customers.Count == 1) { Program.currentCustomer = customers.First(); } else { int count = 1; foreach (var item in customers) { Console.WriteLine($"{count} - Name: {item.Name} Age: {item.Age} "); count++; } Console.WriteLine($"Multiple matches found: {customers.Count}, please select the corresponding number to your name"); string identity = Console.ReadLine(); int identityNum = int.Parse(identity); Program.currentCustomer = customers.ToArray()[identityNum - 1]; } var beermenu = new BeerMenu(_inventoryBL, _orderBL); beermenu.Start(); } else { Console.WriteLine("No customer found with those credentials."); } }
public void CreateCustomer() { Console.WriteLine("Cheers! Welcome to the Dozen family!"); Console.WriteLine("_____________________________________"); Customer customer = new Customer(); Console.WriteLine("Enter your age"); customer.Age = Console.ReadLine(); if (int.Parse(customer.Age) < 21) { Console.WriteLine("You aren't old enough!"); return; } else { Console.WriteLine("Enter your full name [FirstName LastName]"); customer.Name = Console.ReadLine(); Console.WriteLine("Enter your phone number"); customer.PhoneNumber = Console.ReadLine(); Program.currentCustomer = _customerBL.AddCustomer(customer); Console.WriteLine("Customer successfully added!"); var beermenu = new BeerMenu(_inventoryBL, _orderBL); beermenu.Start(); } }
public void Start() { bool run = true; do { Console.WriteLine(); Console.WriteLine("Welcome to the Main Menu!"); Console.WriteLine("Are you a new or an existing customer?"); Console.WriteLine("[0] - Existing Customer"); Console.WriteLine("[1] - New Customer"); // Console.WriteLine("[2] - Place an Order (Existing Customers)"); // Console.WriteLine("[3] - Select a Store Location"); Console.WriteLine("[2] - Back"); //Console.WriteLine("[5] - Main Menu"); Console.WriteLine("----------------------------------------"); string selection = Console.ReadLine(); switch (selection) { case "0": GetCustomers(); break; case "1": CreateCustomer(); break; case "3": BeerMenu beerMenu = new BeerMenu(_inventoryBL, _orderBL); beerMenu.Start(); break; case "4": GetStores(); break; case "2": run = false; break; // case "5" : // drinkMenu.MainMenu(); // break; default: Console.WriteLine("Invalid! Try again"); break; } } while (run); }