public async Task <IActionResult> Criar([FromBody] CriarParticipanteDto participante) { var response = await _participanteService.Criar(participante); if (!response.Sucess) { return(BadRequest(response)); } return(Ok(response)); }
public async Task <ServiceResponse <ObterParticipanteDto> > Criar(CriarParticipanteDto criarParticipante) { var sr = new ServiceResponse <ObterParticipanteDto>(); try { var participante = _mapper.Map <Participante>(criarParticipante); var response = await _participanteRepository.Criar(participante); sr.Value = _mapper.Map <ObterParticipanteDto>(response); } catch (Exception ex) { sr.Sucess = false; sr.Messages.Add(ex.Message); } return(sr); }