Example #1
0
        public async Task CreateSeat(SeatType seat)
        {
            if (!await _conferenceRepository.CheckExistenceById(seat.ConferenceId))
            {
                throw new ApplicationException("Conference record wasn't found!");
            }

            await _seatRepository.AddConferenceSeat(seat);

            var conference = await _conferenceRepository.Get(seat.ConferenceId);

            // Don't publish new seats if the conference was never published
            // (and therefore is not published either).
            if (conference.WasEverPublished)
            {
                _hostServiceBus.Publish <ISeatCreated>(new SeatCreated(seat));
            }
        }