source: source/MovieZilla-master/src/main/java/com/example/demo/controller/EmployeeController.java

Last change on this file was fc7ec52, checked in by darkopopovski <darkopopovski39@…>, 2 years ago

all files

  • Property mode set to 100644
File size: 1.7 KB
Line 
1package com.example.demo.controller;
2
3import com.example.demo.model.Client.Client;
4import com.example.demo.model.Genre;
5import com.example.demo.repository.ClientRepository;
6import com.example.demo.repository.FirmRepository;
7import com.example.demo.repository.GenreRepository;
8import com.example.demo.repository.ReservationsRepository;
9import org.springframework.stereotype.Controller;
10import org.springframework.ui.Model;
11import org.springframework.web.bind.annotation.GetMapping;
12import org.springframework.web.bind.annotation.RequestMapping;
13import org.springframework.web.bind.annotation.RequestParam;
14
15import java.util.Collection;
16import java.util.List;
17
18@Controller
19@RequestMapping("/employee")
20public class EmployeeController {
21
22 private final ReservationsRepository reservationsRepository;
23 private final FirmRepository firmRepository;
24 private final ClientRepository clientRepository;
25 private final GenreRepository genreRepository;
26
27 public EmployeeController(ReservationsRepository reservationsRepository, FirmRepository firmRepository, ClientRepository clientRepository, GenreRepository genreRepository) {
28 this.reservationsRepository = reservationsRepository;
29 this.firmRepository = firmRepository;
30 this.clientRepository = clientRepository;
31 this.genreRepository = genreRepository;
32 }
33
34 @GetMapping
35 public String getMoviePage(@RequestParam(required = false) String error, Model model) {
36 if (error != null && !error.isEmpty()) {
37 model.addAttribute("hasError", true);
38 model.addAttribute("error", error);
39 }
40 Collection<Client> clients = this.clientRepository.findByUsersStats();
41 model.addAttribute("clients", clients);
42 return "employee";
43 }
44
45
46}
Note: See TracBrowser for help on using the repository browser.