/** POST /preferencess -> Create a new preferences. */ @RequestMapping( value = "/preferencess", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Void> create(@Valid @RequestBody Preferences preferences) throws URISyntaxException { log.debug("REST request to save Preferences : {}", preferences); if (preferences.getId() != null) { return ResponseEntity.badRequest() .header("Failure", "A new preferences cannot already have an ID") .build(); } preferencesRepository.save(preferences); preferencesSearchRepository.save(preferences); return ResponseEntity.created(new URI("/api/preferencess/" + preferences.getId())).build(); }
/** PUT /preferencess -> Updates an existing preferences. */ @RequestMapping( value = "/preferencess", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Void> update(@Valid @RequestBody Preferences preferences) throws URISyntaxException { log.debug("REST request to update Preferences : {}", preferences); if (preferences.getId() == null) { return create(preferences); } preferencesRepository.save(preferences); preferencesSearchRepository.save(preferences); return ResponseEntity.ok().build(); }