public void CancelBooking()
        {
            Customers customer = FindCustomerByEmail();

            Console.WriteLine("Please enter booking reference code:");
            var refCode  = Console.ReadLine();
            var bookings = BookingsRepository.GetAll();
            var booking  = bookings.FirstOrDefault(x => x.RefCode == refCode && x.FromDate > DateTime.Now && x.CustomerId == customer.Id);

            if (booking == null)
            {
                throw new FlowException("Booking not found!");
            }
            Console.WriteLine($"Confirm you want to cancel booking {booking.RefCode}? Enter y if yes!");
            var confirm = Console.ReadLine();

            if (confirm.ToLower() == "y")
            {
                booking.IsCancelled = true;
            }
            BookingsRepository.Update(booking);
            BookingsRepository.SaveEntities();
            Console.WriteLine("Booking is cancelled!Please check your credit card after 10 minutes!");
        }
        public void Book()
        {
            Customers customer = FindCustomerByEmail();
            var       bookings = BookingsRepository.GetAllInclude(x => x.BookingRooms);
            var       rooms    = RoomsRepository.GetAllInclude(x => x.BookingRooms);
            var       maxDate  = Convert.ToDateTime("01/01/2021 12:00:00 AM");

            Console.WriteLine($"Max booking date: {maxDate}");
            Console.WriteLine("Please enter Check-In date (format MM/dd/yyyy !):");
            var validFrom = Convert.ToDateTime(Console.ReadLine());

            if (validFrom < DateTime.Now || validFrom > maxDate)
            {
                throw new FlowException("Please enter valid date!");
            }
            Console.WriteLine("Please enter Check-Out date (format MM/dd/yyyy !):");
            var validTo = Convert.ToDateTime(Console.ReadLine());

            if (validTo <= validFrom || validTo > maxDate)
            {
                throw new FlowException("Please enter valid date!");
            }
            var newBooking = new Bookings()
            {
                CustomerId   = customer.Id,
                NumberOfDays = int.Parse((validTo - validFrom).TotalDays.ToString()),
                FromDate     = validFrom,
                ToDate       = validTo,
                IsCancelled  = false,
                RefCode      = GenerateRefCode(),
                BookingRooms = new List <BookingRooms>()
            };
            var activeBookings = bookings.Where(x => x.ToDate > DateTime.Now && x.ToDate > validFrom).ToList();
            var roomsList      = new List <int>();

            foreach (var booking in activeBookings)
            {
                if (booking.IsCancelled != true)
                {
                    roomsList.AddRange(booking.BookingRooms.Select(x => x.RoomId).ToList());
                }
            }
            Console.WriteLine(string.Join(",", roomsList));
            bool anotherRoom = true;

            while (anotherRoom)
            {
                PrintAvailRooms(roomsList, rooms);
                Rooms room       = FindRoom();
                var   bookedRoom = new BookingRooms()
                {
                    RoomId    = room.Id,
                    BookingId = newBooking.Id
                };
                bool available = CheckRoomAvail(roomsList, room);
                if (available == false)
                {
                    throw new FlowException("Room is not available!");
                }
                var checkRoom = newBooking.BookingRooms.FirstOrDefault(x => x.RoomId == room.Id);
                if (checkRoom != null)
                {
                    throw new FlowException("You already have this room!");
                }
                Console.WriteLine($"This room has {room.MaxPersons} max persons allowed! You may need to book another room if needed!");
                Console.WriteLine("Please enter number of persons:");
                var checkPersons = int.TryParse(Console.ReadLine(), out int roomPersons);
                CheckInput(checkPersons);
                CheckAboveZero(roomPersons);
                if (roomPersons > room.MaxPersons)
                {
                    throw new FlowException("Please check room details!");
                }
                newBooking.BookingRooms.Add(bookedRoom);
                Console.WriteLine("Do you want to add another room to your booking? Enter y if yes,any other key if no!");
                var userChoice = Console.ReadLine();
                anotherRoom = userChoice.ToLower() == "y";
            }
            Console.WriteLine($"You have booked successfully! Your Reference Code is: {newBooking.RefCode}");
            BookingsRepository.Add(newBooking);
            BookingsRepository.SaveEntities();
        }