public IHttpActionResult PostConsequenciaViewModel(ConsequenciaViewModel consequenciaViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _consequenciaAppService.Criar(consequenciaViewModel); return(CreatedAtRoute("DefaultApi", new { id = consequenciaViewModel.Id }, consequenciaViewModel)); }
public IHttpActionResult GetConsequenciaViewModel(Guid id) { ConsequenciaViewModel consequenciaViewModel = _consequenciaAppService.BuscarPorId(id); if (consequenciaViewModel == null) { return(NotFound()); } return(Ok(consequenciaViewModel)); }
public IHttpActionResult PutConsequenciaViewModel(Guid id, ConsequenciaViewModel consequenciaViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != consequenciaViewModel.Id || !ConsequenciaViewModelExists(id)) { return(BadRequest()); } _consequenciaAppService.Atualizar(consequenciaViewModel); return(StatusCode(HttpStatusCode.NoContent)); }