Exemplo n.º 1
0
 /** POST /codingSessions -> Create a new codingSession. */
 @RequestMapping(
     value = "/codingSessions",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> create(@RequestBody CodingSession codingSession)
     throws URISyntaxException {
   log.debug("REST request to save CodingSession : {}", codingSession);
   if (codingSession.getId() != null) {
     return ResponseEntity.badRequest()
         .header("Failure", "A new codingSession cannot already have an ID")
         .build();
   }
   codingSessionRepository.save(codingSession);
   return ResponseEntity.created(new URI("/api/codingSessions/" + codingSession.getId())).build();
 }
Exemplo n.º 2
0
 /** PUT /codingSessions -> Updates an existing codingSession. */
 @RequestMapping(
     value = "/codingSessions",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> update(@RequestBody CodingSession codingSession)
     throws URISyntaxException {
   log.debug("REST request to update CodingSession : {}", codingSession);
   if (codingSession.getId() == null) {
     return create(codingSession);
   }
   codingSessionRepository.save(codingSession);
   return ResponseEntity.ok().build();
 }