Exemplo n.º 1
0
        public void Run()
        {
            listOfCustomers = _customerRepository.GetCustomers();
            bool isRunning = true;

            while (isRunning)
            {
                Console.WriteLine("Choose a menu item:" +
                                  "\n1. View list of customers" +
                                  "\n2. Create new customer" +
                                  "\n3. Update list of customers" +
                                  "\n4. Delete customer" +
                                  "\n5. Exit");
                int input = int.Parse(Console.ReadLine());
                switch (input)
                {
                case 1:     //View list of Customers
                    ViewCustomers();
                    break;

                case 2:     //Create New Customer
                    NewCustomer();
                    break;

                case 3:     //Update Customer List
                            //UpdateCustomerList
                    break;

                case 4:     //Delete From Customer List
                    DeleteCustomer();
                    break;

                case 5:     //exit
                    isRunning = false;
                    break;

                default:
                    Console.WriteLine("Invalid Response.\n Please select 1-5");
                    Console.ReadLine();
                    break;
                }
            }
        }
Exemplo n.º 2
0
        private void ListCustomers()
        {
            List <Customer> customers = _repo.GetCustomers();

            foreach (var customer in customers)
            {
                Console.WriteLine("Customer \n" +
                                  $"First Name: {customer.FirstName} \n" +
                                  $"Last Name: {customer.LastName} \n" +
                                  $"Type: {customer.Type} \n" +
                                  $"Message: {customer.Message} \n");
            }

            Console.WriteLine("1. Back to menu");
            int choice = UserChoice();

            if (choice == 1)
            {
                RunStartMenu();
            }
        }
Exemplo n.º 3
0
        public void Run()
        {
            List <Customer> customers = _customerRepo.GetCustomers();
            bool            loop      = true;

            while (loop)
            {
                string input = ConsoleMenu();
                switch (input)
                {
                case "1":
                    AddCustomer();
                    break;

                case "2":
                    Console.WriteLine("Enter the last name of the customer you would like to edit\n");
                    string lastName1 = Console.ReadLine();
                    EditCustomer(lastName1);
                    break;

                case "3":
                    Console.WriteLine("\nEnter the last name of the customer you would like to view\n");
                    string lastName = Console.ReadLine();
                    GetCustomer(lastName);
                    break;

                case "4":
                    ViewCustomers();
                    break;

                case "X":
                    loop = false;
                    break;

                default:
                    break;
                }
            }
        }