public List <Booking> GetBookingsFor(Passenger stubPassenger) { return(BookingList.Where(x => x.Passengers.Fname == stubPassenger.Fname && x.Passengers.Lname == stubPassenger.Lname).ToList()); }
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); }