Пример #1
0
  @RequestMapping(value = "/{swishId}", method = RequestMethod.DELETE)
  public ResponseEntity<SwishResource> deleteSwish(@PathVariable Long swishId) {
    Swish swish = service.deleteSwish(swishId);

    if (swish != null) {
      SwishResource res = new SwishResourceAsm().toResource(swish);
      return new ResponseEntity<SwishResource>(res, HttpStatus.OK);
    } else {
      return new ResponseEntity<SwishResource>(HttpStatus.NOT_FOUND);
    }
  }
Пример #2
0
  @RequestMapping(value = "/{swishId}", method = RequestMethod.PUT)
  public ResponseEntity<SwishResource> updateSwish(
      @PathVariable Long swishId, @RequestBody SwishResource sentSwish) {
    Swish swish = service.updateSwish(swishId, sentSwish.toSwish());

    if (swish != null) {
      SwishResource res = new SwishResourceAsm().toResource(swish);
      return new ResponseEntity<SwishResource>(res, HttpStatus.OK);
    } else {
      return new ResponseEntity<SwishResource>(HttpStatus.NOT_FOUND);
    }
  }