Bladeren bron

new changes

Xcuello 5 jaren geleden
bovenliggende
commit
d4d8607ec2

+ 7
- 7
src/main/java/io/zipcoder/crudapp/Person.java Bestand weergeven

12
     @GeneratedValue(strategy = GenerationType.AUTO)
12
     @GeneratedValue(strategy = GenerationType.AUTO)
13
     private String firstName;
13
     private String firstName;
14
     private String lastName;
14
     private String lastName;
15
-    private Integer idNumber;
15
+    private Integer id;
16
 
16
 
17
 
17
 
18
     public Person() {
18
     public Person() {
21
 
21
 
22
     public String getFirstName() {
22
     public String getFirstName() {
23
 
23
 
24
-        return firstName;
24
+        return this.firstName;
25
     }
25
     }
26
 
26
 
27
     public void setFirstName(String firstName) {
27
     public void setFirstName(String firstName) {
31
 
31
 
32
     public String getLastName() {
32
     public String getLastName() {
33
 
33
 
34
-        return lastName;
34
+        return this.lastName;
35
     }
35
     }
36
 
36
 
37
     public void setLastName(String lastName) {
37
     public void setLastName(String lastName) {
39
         this.lastName = lastName;
39
         this.lastName = lastName;
40
     }
40
     }
41
 
41
 
42
-    public Integer getIdNumber() {
42
+    public Integer getId() {
43
 
43
 
44
-        return idNumber;
44
+        return this.id;
45
     }
45
     }
46
 
46
 
47
-    public void setIdNumber(Integer idNumber) {
47
+    public void setId(Integer id) {
48
 
48
 
49
-        this.idNumber = idNumber;
49
+        this.id = id;
50
     }
50
     }
51
 }
51
 }
52
 
52
 

+ 2
- 2
src/main/java/io/zipcoder/crudapp/PersonController.java Bestand weergeven

42
     }
42
     }
43
 
43
 
44
     @RequestMapping(value = "/people/{id}", method = RequestMethod.PUT)
44
     @RequestMapping(value = "/people/{id}", method = RequestMethod.PUT)
45
-    public ResponseEntity<Person> updatePerson(@PathVariable Integer id,@RequestBody Person updatedPerson) {
45
+    public ResponseEntity<Person> updatePerson(@PathVariable Integer id, @RequestBody Person updatedPerson) {
46
 
46
 
47
         Person p = personRepository.findOne(id);
47
         Person p = personRepository.findOne(id);
48
 
48
 
51
             return new ResponseEntity<>(updatedPerson, HttpStatus.OK);
51
             return new ResponseEntity<>(updatedPerson, HttpStatus.OK);
52
         }
52
         }
53
 
53
 
54
-        updatedPerson.setIdNumber(id);
54
+        updatedPerson.setId(id);
55
 
55
 
56
         personRepository.save(updatedPerson);
56
         personRepository.save(updatedPerson);
57
 
57