예제 #1
0
        public void ScheduleCab(BookingService bookingService)
        {
            Console.WriteLine("Do You Want to Book a Cab (y/n)...");
            var answer = Console.ReadKey();

            if (answer.Key != ConsoleKey.Y)
            {
                return;
            }

            ConsoleKeyInfo moreCab;

            do
            {
                var     bookingDetails = InputBookingDetails();
                BookCab bookCab        = new BookCab(bookingDetails);
                bookingService.ScheduleCab(bookCab);
                Console.WriteLine("Do You Want to Book More Cab (y/n)...");
                moreCab = Console.ReadKey();
            } while (moreCab.Key == ConsoleKey.Y);

            Console.WriteLine("\n***********************************");
            Console.WriteLine("\nConfirm Booking (y/n)...");
            var confirmed = Console.ReadKey();

            Console.WriteLine("***********************************");
            if (confirmed.Key == ConsoleKey.Y)
            {
                bookingService.ConfirmService(true);
            }
            Console.WriteLine("\n***********************************");
        }
예제 #2
0
        public void ScheduleCabCancellation(BookingService bookingService)
        {
            Console.WriteLine("\nDo You Want to Cancel any Cab (y/n)...");
            var isCancel = Console.ReadKey();

            if (isCancel.Key == ConsoleKey.Y)
            {
                var       cancelDetails = InputCancelDetails();
                CancelCab cancelCab     = new CancelCab(cancelDetails);
                bookingService.CancelCab(cancelCab);

                Console.WriteLine("\nConfirm Cancel (y/n)...");
                var confirmedCancel = Console.ReadKey();
                if (confirmedCancel.Key == ConsoleKey.Y)
                {
                    bookingService.ConfirmService(false);
                }
            }
        }