source: source/freeparkingspace/src/main/java/com/proekt/Controller/Employee.java

Last change on this file was 31d67c0, checked in by zlatko2810 <zlatko.stojanovski@…>, 2 years ago

proekt

  • Property mode set to 100644
File size: 1.4 KB
Line 
1package com.proekt.Controller;
2
3
4import com.proekt.Repository.NajavaRepository;
5import com.proekt.Repository.VrabotenRepository1;
6import com.proekt.Service.EmployeeService;
7import org.springframework.stereotype.Controller;
8import org.springframework.ui.Model;
9import org.springframework.web.bind.annotation.*;
10
11@Controller
12@RequestMapping("/employee")
13public class Employee {
14
15 private final VrabotenRepository1 vrabotenRepository1;
16 private final NajavaRepository najavaRepository;
17 private final EmployeeService employeeService;
18
19 public Employee(VrabotenRepository1 vrabotenRepository1, NajavaRepository najavaRepository, EmployeeService employeeService) {
20 this.vrabotenRepository1 = vrabotenRepository1;
21 this.najavaRepository = najavaRepository;
22 this.employeeService = employeeService;
23 }
24
25 @GetMapping
26 public String getMoviePage(@RequestParam(required = false) String error, Model model) {
27 if (error != null && !error.isEmpty()) {
28 model.addAttribute("hasError", true);
29 model.addAttribute("error", error);
30 }
31
32 model.addAttribute("employee", this.vrabotenRepository1.findAll());
33 model.addAttribute("bodyContent", "employee");
34 return "master-template";
35 }
36 @PostMapping("/{id}/delete")
37 public String delete(@PathVariable String id) {
38 this.employeeService.delete(id);
39 return "redirect:/employee";
40 }
41}
Note: See TracBrowser for help on using the repository browser.