Browse Source

pathvariable

Seth 5 years ago
parent
commit
dfb033320a

+ 4
- 4
src/main/java/com/zipcodewilmington/bakery/Controllers/MuffinController.java View File

@@ -29,16 +29,16 @@ public class MuffinController {
29 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 34
         Muffin foundMuffin = muffinRepository.findOne(id);
35 35
         foundMuffin.setFlavor(muffin.getFlavor());
36 36
 
37 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 42
         this.muffinRepository.delete(id);
43 43
         return new ResponseEntity<>(true, HttpStatus.OK);
44 44
     }