Beispiel #1
0
        public async Task CreateAsync(SpeakerDto speaker)
        {
            var alreadyExists = await _repository.ExistsAsync(speaker.Id);

            if (alreadyExists)
            {
                throw new SpeakerAlreadyExistsException(speaker.Id);
            }

            await _repository.AddAsync(speaker.AsEntity());
        }
Beispiel #2
0
        public async Task CreateAsync(SpeakerDto speaker)
        {
            var alreadyExists = await _repository.ExistsAsync(speaker.Id);

            if (alreadyExists)
            {
                throw new SpeakerAlreadyExistsException(speaker.Id);
            }

            await _repository.AddAsync(speaker.AsEntity());

            await _messageBroker.PublishAsync(new SpeakerCreated(speaker.Id, speaker.FullName));
        }
Beispiel #3
0
        public async Task <ActionResult <ConferenceDTO.SpeakerResponse> > PostSpeaker(ConferenceDTO.SpeakerRequest input)
        {
            var speaker = await _speakersRepository.AddAsync(input.MapSpeaker());

            return(CreatedAtAction(nameof(GetSpeaker), new { id = speaker.ID }, speaker.MapSpeakerResponse()));
        }