示例#1
0
        public Booking Handle(CreateBookingRequest message)
        {
            var room = _roomRepository.GetRoomById(message.RoomId);

            var bookingPeriod = new BookingPeriod(message.StartTime, message.EndTime);
            var booking       = Booking.Create(bookingPeriod, room);

            _bookingRepository.CreateBooking(booking);
            DomainEvents.PublishEvent(new BookingCreatedEvent(booking));

            return(booking);
        }