public ActionResult Insert([FromBody] PersonDTO personDTO) { try { if (personDTO == null) { return(NotFound()); } PersonDTO person = _applicationServicePerson.GetById(personDTO.PersonId); if (person.PersonId > 0) { return(BadRequest()); } _applicationServicePerson.Add(personDTO); int position = _applicationServicePerson.GetClientPosition(personDTO.PersonId); if (position > 0) { return(Ok(new { Position = position })); } else { return(NotFound()); } } catch (Exception ex) { throw ex; } }
public ActionResult Post([FromBody] PersonDTO personDTO) { try { if (personDTO == null) { return(NotFound()); } _applicationServicePerson.Add(personDTO); return(Ok("Person registered!")); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult Post([FromBody] PersonDTO PersonDTO) { try { if (PersonDTO == null) { return(NotFound()); } _applicationServicePerson.Add(PersonDTO); return(Ok(new Response <string>("Pessoa cadastrada com sucesso!"))); } catch (Exception ex) { throw ex; } }