Seth před 5 roky
rodič
revize
dfb033320a

+ 4
- 4
src/main/java/com/zipcodewilmington/bakery/Controllers/MuffinController.java Zobrazit soubor

29
         return new ResponseEntity<>(this.muffinRepository.save(muffin), HttpStatus.CREATED);
29
         return new ResponseEntity<>(this.muffinRepository.save(muffin), HttpStatus.CREATED);
30
     }
30
     }
31
 
31
 
32
-    @PutMapping("/muffins")
33
-    public ResponseEntity<Muffin> update(Long id, Muffin muffin) {
32
+    @PutMapping("/muffins/{id}")
33
+    public ResponseEntity<Muffin> update(@PathVariable Long id, Muffin muffin) {
34
         Muffin foundMuffin = muffinRepository.findOne(id);
34
         Muffin foundMuffin = muffinRepository.findOne(id);
35
         foundMuffin.setFlavor(muffin.getFlavor());
35
         foundMuffin.setFlavor(muffin.getFlavor());
36
 
36
 
37
         return new ResponseEntity<>(this.muffinRepository.save(foundMuffin), HttpStatus.OK);
37
         return new ResponseEntity<>(this.muffinRepository.save(foundMuffin), HttpStatus.OK);
38
     }
38
     }
39
 
39
 
40
-    @DeleteMapping("/muffins")
41
-    public ResponseEntity<Boolean> destroy(Long id) {
40
+    @DeleteMapping("/muffins/{id}")
41
+    public ResponseEntity<Boolean> destroy(@PathVariable Long id) {
42
         this.muffinRepository.delete(id);
42
         this.muffinRepository.delete(id);
43
         return new ResponseEntity<>(true, HttpStatus.OK);
43
         return new ResponseEntity<>(true, HttpStatus.OK);
44
     }
44
     }