-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCategoriaController.java
More file actions
28 lines (23 loc) · 889 Bytes
/
Copy pathCategoriaController.java
File metadata and controls
28 lines (23 loc) · 889 Bytes
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
package application.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import application.record.CategoriaDTO;
import application.service.CategoriaService;
@RestController
@RequestMapping("/categorias")
public class CategoriaController {
@Autowired
private CategoriaService categoriaService;
@GetMapping
public Iterable<CategoriaDTO> getAll() {
return categoriaService.getAll();
}
@PostMapping
public CategoriaDTO insert(@RequestBody CategoriaDTO categoria) {
return categoriaService.insert(categoria);
}
}