Ejemplo n.º 1
0
 public void TryBook(Booking booking)
 {
     var intersected = _bookings.Find(b => b.Period.Intersects(booking.Period));
     if (intersected == null)
     {
         _bookings.Add(booking);
         booking.Accept();
     }
     booking.Reject("Room already booked at this period.");
 }
Ejemplo n.º 2
0
 public void TryBook(int roomNumber, Booking booking)
 {
     RoomData room;
     if (_rooms.TryGetValue(roomNumber, out room))
     {
         room.TryBook(booking);
     }
     else
     {
         booking.Reject("No such room.");
     }
 }