public PesertaController() { Peserta p = new Peserta(); p.setNomerPeserta("ABC-123"); p.setNama("Endy Muhardin"); p.setTanggalLahir(new Date()); service.simpan(p); }
@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()); }