예제 #1
0
        public void Handle(EditBookingCommand message)
        {
            var response = _repository.Update(message.BookingId, message.Hour, message.Length, message.UserName);

            if (response.Success)
            {
                var updated = new BookingUpdatedEvent(message.BookingId, message.Hour, message.UserName, message.Length);
                Bus.RaiseEvent(updated);
            }
        }
        public void BookingUpdated(BookingUpdatedEvent @event)
        {
            _bookingRepository.Save(@event.Source);

            var bookingUpdated = new BookingUpdated
            {
                Id            = @event.Source.Id.Value,
                Start         = @event.Source.Start,
                End           = @event.Source.End,
                BookingTypeId = @event.Source.BookingType.Id.Value
            };

            _bus.Publish(bookingUpdated);
        }