Exemplo n.º 1
0
 @RequestMapping(value = "/card/add", method = RequestMethod.POST, consumes = "application/json")
 public @ResponseBody ResponseEntity<Void> doAdd(@Valid @RequestBody Card card) {
   if (service.add(card)) {
     return new ResponseEntity<Void>(HttpStatus.OK);
   } else {
     return new ResponseEntity<Void>(HttpStatus.BAD_REQUEST);
   }
 }
Exemplo n.º 2
0
  @RequestMapping(value = "/card/add/{value}", method = RequestMethod.GET)
  public @ResponseBody ResponseEntity<Integer> doAddCard(@PathVariable("value") int value) {
    int added = 0;
    for (int i = 0; i < 10; i++) {
      Card card = new Card();
      // card.setIsUsed(false);
      card.setValue(value);
      card.setSeri(randomSeri());
      try {
        service.add(card);
        added++;
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    return new ResponseEntity<Integer>(added, HttpStatus.OK);
  }