예제 #1
0
 /** PUT /fases -> Updates an existing fase. */
 @RequestMapping(
     value = "/fases",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<FaseDTO> update(@RequestBody FaseDTO faseDTO) throws URISyntaxException {
   log.debug("REST request to update Fase : {}", faseDTO);
   if (faseDTO.getId() == null) {
     return create(faseDTO);
   }
   Fase fase = faseMapper.faseDTOToFase(faseDTO);
   Fase result = faseRepository.save(fase);
   faseSearchRepository.save(fase);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityUpdateAlert("fase", faseDTO.getId().toString()))
       .body(faseMapper.faseToFaseDTO(result));
 }
예제 #2
0
 /** POST /fases -> Create a new fase. */
 @RequestMapping(
     value = "/fases",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<FaseDTO> create(@RequestBody FaseDTO faseDTO) throws URISyntaxException {
   log.debug("REST request to save Fase : {}", faseDTO);
   if (faseDTO.getId() != null) {
     return ResponseEntity.badRequest()
         .header("Failure", "A new fase cannot already have an ID")
         .body(null);
   }
   Fase fase = faseMapper.faseDTOToFase(faseDTO);
   Fase result = faseRepository.save(fase);
   faseSearchRepository.save(result);
   return ResponseEntity.created(new URI("/api/fases/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("fase", result.getId().toString()))
       .body(faseMapper.faseToFaseDTO(result));
 }