-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClientController.java
More file actions
45 lines (35 loc) · 1.29 KB
/
ClientController.java
File metadata and controls
45 lines (35 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.ffong.demo.client.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ffong.demo.client.model.Client;
import com.ffong.demo.client.service.ClientService;
@RestController
@RequestMapping("/client")
public class ClientController {
@Autowired
private ClientService clientService;
@GetMapping()
public List<Client> list() {
return clientService.list();
}
@PostMapping()
public Client insert(@RequestBody Client client) {
return clientService.insert(client);
}
@PutMapping("/{idClient}")
public Client update(@PathVariable Long idClient, @RequestBody Client client) {
return clientService.update(idClient, client);
}
@DeleteMapping("/{idClient}")
public void delete(@PathVariable Long idClient) {
clientService.delete(idClient);
}
}