예제 #1
0
        public void List()
        {
            System.Console.WriteLine("All customers registered so far");

            List <Customer> customers = _customerService.GetAllCustomers();

            customers.ForEach(c =>
            {
                CommandConsoleUtil.PrintCustomer(c);
                System.Console.WriteLine("--------------");
            });
        }
예제 #2
0
        public void Register()
        {
            System.Console.WriteLine("What is the Firstname");
            string firstName = CommandConsoleUtil.ReadString();

            System.Console.WriteLine("What is the Lastname");
            string lastName = CommandConsoleUtil.ReadString();

            Customer customerUnregistered = new Customer();

            customerUnregistered.FirstName = firstName;
            customerUnregistered.LastName  = lastName;
            Customer?customerRegistered = _customerService.RegisterCustomer(customerUnregistered);

            System.Console.WriteLine("Customer registered successfully with the following : ");
            CommandConsoleUtil.PrintCustomer(customerRegistered);
        }
예제 #3
0
        public void Downgrade()
        {
            System.Console.WriteLine("What is the customer Id you want to downgrade? ");
            string   customerId = CommandConsoleUtil.ReadString();
            Customer?customer   = _customerService.FindCustomerById(int.Parse(customerId));

            if (customer != null)
            {
                System.Console.WriteLine("The Customer you want to downgrade is as following");
                CommandConsoleUtil.PrintCustomer(customer);
                System.Console.WriteLine("Do you want to proceed ? Y(es)/N(o)");
                string confirmationRespond = CommandConsoleUtil.ReadString();
                if (confirmationRespond.Equals("yes", StringComparison.InvariantCultureIgnoreCase) ||
                    confirmationRespond.Equals("y", StringComparison.InvariantCultureIgnoreCase))
                {
                    try
                    {
                        Customer?updatedCustomer = _customerService.DownGradeCustomer(customer);
                        System.Console.WriteLine("Customer downgrade successful with the following : ");
                        CommandConsoleUtil.PrintCustomer(updatedCustomer);
                    }
                    catch (Exception)
                    {
                        System.Console.WriteLine("Customer downgrade failed");
                    }
                }
                else
                {
                    System.Console.WriteLine("Wrong Key ");
                }
            }
            else
            {
                System.Console.WriteLine("Can't find the customer with supplied Id. Please try again ");
            }
        }
예제 #4
0
 public void Info()
 {
     CommandConsoleUtil.PrintMainMenu();
 }