Ejemplo n.º 1
0
 public void AddBooking(Booking booking)
 {
     if (IsFree(booking.StartDate, booking.EndDate))
         Bookings.Add(booking);
     else
         throw new BookingException("Room " + RoomDetails.RoomNb + " in hotel " + booking.HotelName + " not available.");
 }
Ejemplo n.º 2
0
 private void FinalizeBooking(Booking booking)
 {
     var hotel = GetHotel(booking.HotelName);
     if (hotel == null)
         throw new ArgumentException("There exists no hotel with the given name.");
     var room = hotel.GetRoom(booking.RoomNb);
     if (room == null)
         throw new ArgumentException("There exists no room with the given number.");
     room.AddBooking(booking);
     db.SaveChanges();
 }