示例#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.");
 }
示例#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.");
     }
 }
示例#3
0
 public void Execute()
 {
     var period = new BookPeriod(_request.BeginAt, _request.EndAt);
     _booking = new Booking(_request.PersonName, period);
     _register.TryBook(_request.RoomNumber, _booking);
 }