Ejemplo n.º 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());
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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()));
        }