|
|
|
@ -31,8 +31,7 @@ public class ContactController { |
|
|
|
|
|
|
|
//Create a new contact
|
|
|
|
@PostMapping("/contacts") |
|
|
|
public ResponseEntity<HttpStatus> createContact(@RequestBody ContactDTO newContact) |
|
|
|
{ |
|
|
|
public ResponseEntity<HttpStatus> createContact(@RequestBody ContactDTO newContact) { |
|
|
|
ContactDTO createdContact = contactService.createContact(newContact); |
|
|
|
if (createdContact == null) { |
|
|
|
return new ResponseEntity<>(HttpStatus.BAD_REQUEST); |
|
|
|
@ -42,8 +41,7 @@ public class ContactController { |
|
|
|
|
|
|
|
//Update an existing contact
|
|
|
|
@PutMapping("/contacts/{id}") |
|
|
|
public ResponseEntity<HttpStatus> updateContact(@PathVariable long id, @RequestBody ContactDTO newContactInfo) |
|
|
|
{ |
|
|
|
public ResponseEntity<HttpStatus> updateContact(@PathVariable long id, @RequestBody ContactDTO newContactInfo) { |
|
|
|
ContactDTO updatedContact = contactService.updateContact(id, newContactInfo); |
|
|
|
if (updatedContact == null) { |
|
|
|
return new ResponseEntity<>(HttpStatus.NOT_FOUND); |
|
|
|
|