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()); }
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)); }
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())); }