public void Start()
        {
            do
            {
                Console.WriteLine("\nPlease decide what you would like to do.");
                Console.WriteLine("[1] View Order History");
                Console.WriteLine("[2] Browse Locations");
                Console.WriteLine("[3] Back to Customer Menu");
                userInput = Console.ReadLine();
                switch (userInput)
                {
                case "1":
                    Log.Information($"Customer Name: {customer.Name} began Viewing Order History");
                    viewOrders();
                    break;

                case "2":
                    locationMenu = new LocationMenu(customer, (ILocationRepo)customerService.repo, new MessagingService());
                    Log.Information($"Customer Name: {customer.Name} began Browsing Locations");
                    locationMenu.Start();
                    break;

                case "3":
                    Log.Information("Back to Customer Menu");
                    break;

                default:
                    Log.Information($"Invalid Input Location Menu: {userInput}");
                    service.InvalidInputMessage();
                    break;
                }
            } while((!userInput.Equals("3")));
        }
Beispiel #2
0
        public void Start()
        {
            do
            {
                Console.WriteLine("\nWelcome Customer! What would you like to do?");
                Console.WriteLine("[0] Signup?");
                Console.WriteLine("[1] Login?");
                Console.WriteLine("[2] Go back to the main menu?");
                userInput = Console.ReadLine();
                switch (userInput)
                {
                case "0":
                    try{
                        SignUp();
                    } catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        break;
                    }
                    Log.Information("New Customer Created");
                    // Sets customer id
                    customer = customerService.GetCustomer(customer.Name, customer.Password);
                    Log.Information("Moved to Location Menu");
                    locationMenu = new LocationMenu(customer, (ILocationRepo)customerService.repo, new MessagingService());
                    locationMenu.Start();
                    break;

                case "1":
                    //call create a customer, get customer details
                    models.Customer loginCustomer = SignIn();
                    try{
                        customerService.GetCustomer(loginCustomer.Name, loginCustomer.Password);
                    } catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        break;
                    }
                    customer          = customerService.GetCustomer(loginCustomer.Name, loginCustomer.Password);
                    customerOrderMenu = new CustomerOrderMenu(customer, (ICustomerRepo)customerService.repo, new MessagingService());
                    customerOrderMenu.Start();
                    break;

                case "2":
                    //back to main menu message
                    Log.Information("Back to Main Menu");
                    service.BackToMainMenuMessage();
                    break;

                default:
                    //invalid input message;
                    Log.Information($"Invalid Input Customer Menu: {userInput}");
                    service.InvalidInputMessage();
                    break;
                }
            } while (!userInput.Equals("2"));
        }