コード例 #1
0
        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());
        }
コード例 #2
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()));
        }