コード例 #1
0
 public PesertaController() {
   Peserta p = new Peserta();
   p.setNomerPeserta("ABC-123");
   p.setNama("Endy Muhardin");
   p.setTanggalLahir(new Date());
   service.simpan(p);
 }
コード例 #2
0
 @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
 @ResponseStatus(HttpStatus.NO_CONTENT)
 public void update(@PathVariable Integer id, @RequestBody Peserta peserta) {
   Peserta px = service.findPesertaById(id);
   px.setNama(peserta.getNama());
   px.setNomerPeserta(peserta.getNomerPeserta());
   px.setTanggalLahir(peserta.getTanggalLahir());
 }