コード例 #1
0
 /** PUT /countryRates -> Updates an existing countryRate. */
 @RequestMapping(
     value = "/countryRates",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<CountryRate> updateCountryRate(@Valid @RequestBody CountryRate countryRate)
     throws URISyntaxException {
   log.debug("REST request to update CountryRate : {}", countryRate);
   if (countryRate.getId() == null) {
     return createCountryRate(countryRate);
   }
   CountryRate result = countryRateRepository.save(countryRate);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityUpdateAlert("countryRate", countryRate.getId().toString()))
       .body(result);
 }
コード例 #2
0
 /** POST /countryRates -> Create a new countryRate. */
 @RequestMapping(
     value = "/countryRates",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<CountryRate> createCountryRate(@Valid @RequestBody CountryRate countryRate)
     throws URISyntaxException {
   log.debug("REST request to save CountryRate : {}", countryRate);
   if (countryRate.getId() != null) {
     return ResponseEntity.badRequest()
         .headers(
             HeaderUtil.createFailureAlert(
                 "countryRate", "idexists", "A new countryRate cannot already have an ID"))
         .body(null);
   }
   CountryRate result = countryRateRepository.save(countryRate);
   return ResponseEntity.created(new URI("/api/countryRates/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("countryRate", result.getId().toString()))
       .body(result);
 }