示例#1
0
 /** DELETE /socios/:id -> delete the "id" socio. */
 @RequestMapping(
     value = "/socios/{id}",
     method = RequestMethod.DELETE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> delete(@PathVariable Long id) {
   log.debug("REST request to delete Socio : {}", id);
   socioRepository.delete(id);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityDeletionAlert("socio", id.toString()))
       .build();
 }
示例#2
0
 /** PUT /socios -> Updates an existing socio. */
 @RequestMapping(
     value = "/socios",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Socio> update(@Valid @RequestBody Socio socio) throws URISyntaxException {
   log.debug("REST request to update Socio : {}", socio);
   if (socio.getId() == null) {
     return create(socio);
   }
   Socio result = socioRepository.save(socio);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityUpdateAlert("socio", socio.getId().toString()))
       .body(result);
 }
示例#3
0
 /** POST /socios -> Create a new socio. */
 @RequestMapping(
     value = "/socios",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Socio> create(@Valid @RequestBody Socio socio) throws URISyntaxException {
   log.debug("REST request to save Socio : {}", socio);
   if (socio.getId() != null) {
     return ResponseEntity.badRequest()
         .header("Failure", "A new socio cannot already have an ID")
         .body(null);
   }
   Socio result = socioRepository.save(socio);
   return ResponseEntity.created(new URI("/api/socios/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("socio", result.getId().toString()))
       .body(result);
 }