/** PUT /clinicHistorys -> Updates an existing clinicHistory. */ @RequestMapping( value = "/clinicHistorys", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<ClinicHistory> update(@RequestBody ClinicHistory clinicHistory) throws URISyntaxException { log.debug("REST request to update ClinicHistory : {}", clinicHistory); if (clinicHistory.getId() == null) { return create(clinicHistory); } ClinicHistory result = clinicHistoryRepository.save(clinicHistory); return ResponseEntity.ok() .headers( HeaderUtil.createEntityUpdateAlert("clinicHistory", clinicHistory.getId().toString())) .body(result); }
/** POST /clinicHistorys -> Create a new clinicHistory. */ @RequestMapping( value = "/clinicHistorys", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<ClinicHistory> create(@RequestBody ClinicHistory clinicHistory) throws URISyntaxException { log.debug("REST request to save ClinicHistory : {}", clinicHistory); if (clinicHistory.getId() != null) { return ResponseEntity.badRequest() .header("Failure", "A new clinicHistory cannot already have an ID") .body(null); } ClinicHistory result = clinicHistoryRepository.save(clinicHistory); return ResponseEntity.created(new URI("/api/clinicHistorys/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert("clinicHistory", result.getId().toString())) .body(result); }