Skip to content

Commit

Permalink
ajustando método do repository para novo padrão
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfelipe committed Apr 26, 2018
1 parent 3ce3dda commit 07dd687
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class NoteController {

@PutMapping("{id}")
fun alter(@PathVariable id: Long, @RequestBody note: Note): Note {
if (noteRepository.exists(id)) {
if (noteRepository.existsById(id)) {
val safeNote = note.copy(id)
return noteRepository.save(safeNote)
}
Expand All @@ -34,8 +34,8 @@ class NoteController {

@DeleteMapping("{id}")
fun delete(@PathVariable id: Long) {
if (noteRepository.exists(id)) {
noteRepository.delete(id)
if (noteRepository.existsById(id)) {
noteRepository.deleteById(id)
}
}

Expand Down

0 comments on commit 07dd687

Please sign in to comment.