public async Task <IActionResult> Post([FromBody] PessoaViewModel pessoa) { try { PessoaParser parser = new PessoaParser(); Pessoa parsedModel = parser.ParseItem(pessoa); var result = await _gateway.CreatePessoa(parsedModel); if (result) { return(Ok(new { message = Constantes.Messages.SUCCESS_MESSAGE_POST_PESSOA })); } else { return(StatusCode(StatusCodes.Status409Conflict, new { message = Constantes.Messages.ERROR_MESSAGE_POST_409_PESSOA })); } } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, new { message = Constantes.Messages.ERROR_MESSAGE_POST_500 })); } }
public PessoaBusiness(IRepository <Pessoa> repository) { _repository = repository; _parser = new PessoaParser(); }