@RestController public class CustomerController extends Object
| Constructor and Description |
|---|
CustomerController(CustomerRepository customerRepository) |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.http.ResponseEntity<Customer> |
createCustomer(Customer customer) |
org.springframework.http.ResponseEntity<Object> |
deleteCustomer(long id) |
org.springframework.http.ResponseEntity<Customer> |
findCustomer(long id) |
List<Customer> |
getAllCustomers(String sortBy) |
org.springframework.http.ResponseEntity<Customer> |
patchCustomer(Customer customer,
long id) |
List<Customer> |
searchByFirstName(String name) |
List<Customer> |
searchByLastName(String name) |
org.springframework.http.ResponseEntity<Customer> |
updateCustomer(Customer customer,
long id) |
public CustomerController(CustomerRepository customerRepository)
@RequestMapping(value="/customers/{id}")
public org.springframework.http.ResponseEntity<Customer> findCustomer(@PathVariable
long id)
@PostMapping(value="/customers") @ResponseStatus(value=CREATED) public org.springframework.http.ResponseEntity<Customer> createCustomer(@RequestBody Customer customer)
@PutMapping(value="/customers/{id}")
public org.springframework.http.ResponseEntity<Customer> updateCustomer(@RequestBody
Customer customer,
@PathVariable
long id)
@PatchMapping(value="/customers/{id}")
public org.springframework.http.ResponseEntity<Customer> patchCustomer(@RequestBody
Customer customer,
@PathVariable
long id)
@DeleteMapping(value="/customers/{id}")
public org.springframework.http.ResponseEntity<Object> deleteCustomer(@PathVariable
long id)
@GetMapping(value="/customers") public List<Customer> getAllCustomers(@RequestParam(value="sortBy",required=false) String sortBy)
@GetMapping(value="/customers/search/first-name") public List<Customer> searchByFirstName(@RequestParam(value="name") String name)
Copyright © 2022. All rights reserved.