/** POST /cardTypes -> Create a new cardType. */
 @RequestMapping(
     value = "/cardTypes",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<CardType> createCardType(@Valid @RequestBody CardType cardType)
     throws URISyntaxException {
   log.debug("REST request to save CardType : {}", cardType);
   if (cardType.getId() != null) {
     return ResponseEntity.badRequest()
         .headers(
             HeaderUtil.createFailureAlert(
                 "cardType", "idexists", "A new cardType cannot already have an ID"))
         .body(null);
   }
   CardType result = cardTypeRepository.save(cardType);
   cardTypeSearchRepository.save(result);
   return ResponseEntity.created(new URI("/api/cardTypes/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("cardType", result.getId().toString()))
       .body(result);
 }
Exemplo n.º 2
0
 /** POST /issuers -> Create a new issuer. */
 @RequestMapping(
     value = "/issuers",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Issuer> createIssuer(@Valid @RequestBody Issuer issuer)
     throws URISyntaxException {
   log.debug("REST request to save Issuer : {}", issuer);
   if (issuer.getId() != null) {
     return ResponseEntity.badRequest()
         .headers(
             HeaderUtil.createFailureAlert(
                 "issuer", "idexists", "A new issuer cannot already have an ID"))
         .body(null);
   }
   Issuer result = issuerRepository.save(issuer);
   issuerSearchRepository.save(result);
   return ResponseEntity.created(new URI("/api/issuers/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("issuer", result.getId().toString()))
       .body(result);
 }