public async Task <IActionResult> PutSpeaker(int id, ConferenceDTO.SpeakerRequest input) { try { var speaker = await _speakersRepository.UpdateAsync(input.MapSpeaker()); if (speaker == null) { return(NotFound()); } } catch (DbUpdateConcurrencyException) { if (_speakersRepository.GetByIdAsync(id) == null) { return(NotFound()); } else { throw; } } return(NoContent()); }
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())); }