コード例 #1
0
 /** PUT /proveedoress -> Updates an existing proveedores. */
 @RequestMapping(
     value = "/proveedoress",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<ProveedoresDTO> updateProveedores(
     @Valid @RequestBody ProveedoresDTO proveedoresDTO) throws URISyntaxException {
   log.debug("REST request to update Proveedores : {}", proveedoresDTO);
   if (proveedoresDTO.getId() == null) {
     return createProveedores(proveedoresDTO);
   }
   Proveedores proveedores = proveedoresMapper.proveedoresDTOToProveedores(proveedoresDTO);
   Proveedores result = proveedoresRepository.save(proveedores);
   return ResponseEntity.ok()
       .headers(
           HeaderUtil.createEntityUpdateAlert("proveedores", proveedoresDTO.getId().toString()))
       .body(proveedoresMapper.proveedoresToProveedoresDTO(result));
 }
コード例 #2
0
 /** POST /proveedoress -> Create a new proveedores. */
 @RequestMapping(
     value = "/proveedoress",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<ProveedoresDTO> createProveedores(
     @Valid @RequestBody ProveedoresDTO proveedoresDTO) throws URISyntaxException {
   log.debug("REST request to save Proveedores : {}", proveedoresDTO);
   if (proveedoresDTO.getId() != null) {
     return ResponseEntity.badRequest()
         .header("Failure", "A new proveedores cannot already have an ID")
         .body(null);
   }
   Proveedores proveedores = proveedoresMapper.proveedoresDTOToProveedores(proveedoresDTO);
   Proveedores result = proveedoresRepository.save(proveedores);
   return ResponseEntity.created(new URI("/api/proveedoress/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("proveedores", result.getId().toString()))
       .body(proveedoresMapper.proveedoresToProveedoresDTO(result));
 }