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