Seth преди 5 години
родител
ревизия
7701a444ce
променени са 1 файла, в които са добавени 4 реда и са изтрити 4 реда
  1. 4
    4
      src/main/java/com/zipcodewilmington/bakery/Controllers/BakerController.java

+ 4
- 4
src/main/java/com/zipcodewilmington/bakery/Controllers/BakerController.java Целия файл

29
         return new ResponseEntity<>(this.bakerRepository.save(baker), HttpStatus.CREATED);
29
         return new ResponseEntity<>(this.bakerRepository.save(baker), HttpStatus.CREATED);
30
     }
30
     }
31
 
31
 
32
-    @PutMapping("/bakers")
33
-    public ResponseEntity<Baker> update(Long id, Baker baker) {
32
+    @PutMapping("/bakers/{id}")
33
+    public ResponseEntity<Baker> update(@PathVariable Long id, Baker baker) {
34
         Baker foundBaker = bakerRepository.findOne(id);
34
         Baker foundBaker = bakerRepository.findOne(id);
35
 
35
 
36
         foundBaker.setName(baker.getName());
36
         foundBaker.setName(baker.getName());
39
         return new ResponseEntity<>(this.bakerRepository.save(foundBaker), HttpStatus.OK);
39
         return new ResponseEntity<>(this.bakerRepository.save(foundBaker), HttpStatus.OK);
40
     }
40
     }
41
 
41
 
42
-    @DeleteMapping("/bakers/")
43
-    public ResponseEntity<Boolean> destroy(Long id) {
42
+    @DeleteMapping("/bakers/{id}")
43
+    public ResponseEntity<Boolean> destroy(@PathVariable Long id) {
44
         this.bakerRepository.delete(id);
44
         this.bakerRepository.delete(id);
45
         return new ResponseEntity<>(true, HttpStatus.OK);
45
         return new ResponseEntity<>(true, HttpStatus.OK);
46
     }
46
     }