source: source/MovieZilla-master/src/main/java/com/example/demo/controller/AuditoriumController.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.2 KB
Line 
1package com.example.demo.controller;
2
3import com.example.demo.model.Auditorium;
4import com.example.demo.model.Movie;
5import com.example.demo.repository.AuditoriumRepository;
6import org.springframework.stereotype.Controller;
7import org.springframework.ui.Model;
8import org.springframework.web.bind.annotation.GetMapping;
9import org.springframework.web.bind.annotation.RequestMapping;
10import org.springframework.web.bind.annotation.RequestParam;
11
12import java.util.List;
13
14@Controller
15@RequestMapping("/auditoriums")
16public class AuditoriumController {
17
18 private final AuditoriumRepository auditoriumRepository;
19
20
21 public AuditoriumController(AuditoriumRepository auditoriumRepository) {
22 this.auditoriumRepository = auditoriumRepository;
23 }
24
25 @GetMapping
26 public String getProductPage(@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 List<Auditorium> auditoriums = this.auditoriumRepository.findAll();
32 model.addAttribute("auditorium", auditoriums);
33 model.addAttribute("bodyContent", "auditoriums");
34 return "master-template";
35 }
36}
Note: See TracBrowser for help on using the repository browser.