Esempio n. 1
0
 public List <Booking> GetBookingsFor(Passenger stubPassenger)
 {
     return(BookingList.Where(x => x.Passengers.Fname == stubPassenger.Fname &&
                              x.Passengers.Lname == stubPassenger.Lname).ToList());
 }
Esempio n. 2
0
        public void CreateBooking(string name, DateTime dateOfTour, int numberOfSeats, Passenger stubPassenger)
        {
            var tour = TourSchedule.ToursList.FirstOrDefault(x => x.Name == name);

            if (tour == null)
            {
                throw new TourDoesentExistOnBookedPersoException();
            }

            if (tour.NumberOfSeats < numberOfSeats)
            {
                throw new NoSeatsLeftOnBookingTourException();
            }

            var booking = new Booking();

            booking.DateOfTour    = dateOfTour;
            booking.Passengers    = stubPassenger;
            booking.TourName      = name;
            booking.NumberOfSeats = numberOfSeats;
            BookingList.Add(booking);
        }