source: src/main/java/com/example/baza/web/PozajmicaController.java@ ed20c2c

Last change on this file since ed20c2c was ed20c2c, checked in by HumaSejdini <humasejdini12@…>, 2 years ago

Initial commit

  • Property mode set to 100644
File size: 3.2 KB
Line 
1package com.example.baza.web;
2
3
4
5import com.example.baza.model.*;
6import com.example.baza.service.*;
7import org.springframework.stereotype.Controller;
8import org.springframework.ui.Model;
9import org.springframework.web.bind.annotation.*;
10
11import java.time.LocalDate;
12import java.util.List;
13
14@Controller
15@RequestMapping("/borrow")
16public class PozajmicaController {
17 private final InstancaOdKnigaService instancaOdKnigaService;
18 private final KaznaService kaznaService;
19 private final BibliotekarService bibliotekarService;
20 private final ChlenService chlenService;
21 private final PozajmicaService pozajmicaService;
22 private final ChovekService chovekService;
23 private final IzdavacService izdavacService;
24 private final KategorijaService kategorijaService;
25 private final AvtorService avtorService;
26 private final KnigiService knigiService;
27
28 public PozajmicaController(InstancaOdKnigaService instancaOdKnigaService, KaznaService kaznaService, BibliotekarService bibliotekarService, ChlenService chlenService, PozajmicaService pozajmicaService, ChovekService chovekService, IzdavacService izdavacService, KategorijaService kategorijaService, AvtorService avtorService, KnigiService knigiService) {
29 this.instancaOdKnigaService = instancaOdKnigaService;
30 this.kaznaService = kaznaService;
31 this.bibliotekarService = bibliotekarService;
32 this.chlenService = chlenService;
33 this.pozajmicaService = pozajmicaService;
34 this.chovekService = chovekService;
35 this.izdavacService = izdavacService;
36 this.kategorijaService = kategorijaService;
37 this.avtorService = avtorService;
38 this.knigiService = knigiService;
39 }
40 @GetMapping
41 public String getProductPage(@RequestParam(required = false) String error, Model model){
42 if(error!=null && !error.isEmpty()){
43 model.addAttribute("hasError",true);
44 model.addAttribute("error",error);
45 }
46 List<Pozajmica> pozajmici=this.pozajmicaService.listAll();
47 List<InstancaOdKniga> isbn=this.instancaOdKnigaService.listAll();
48 List<Bibliotekar2> bibliotekar=this.bibliotekarService.findAll();
49 List<Chlen2> chlen=this.chlenService.findAll();
50 List<Chovek2> chovek=this.chovekService.listAll();
51
52 model.addAttribute("pozajmici",pozajmici);
53 model.addAttribute("bibliotekar",bibliotekar);
54 model.addAttribute("isbn",isbn);
55 model.addAttribute("chlen",chlen);
56 model.addAttribute("chovek",chovek);
57 return "pozajmica.html";
58 }
59
60 @GetMapping("/add-borrowed-book")
61 public String addProductPage(Model model){
62 List<Pozajmica> pozajmici=this.pozajmicaService.listAll();
63 List<InstancaOdKniga> isbn=this.instancaOdKnigaService.listAll();
64 List<Bibliotekar2> bibliotekar=this.bibliotekarService.findAll();
65 List<Chlen2> chlen=this.chlenService.findAll();
66 List<Knigi> knigi=this.knigiService.listAll();
67 model.addAttribute("pozajmici",pozajmici);
68 model.addAttribute("bibliotekar",bibliotekar);
69 model.addAttribute("isbn",isbn);
70 model.addAttribute("chlen",chlen);
71 model.addAttribute("knigi",knigi);
72 return "add-borrow";
73 }
74
75
76}
77
Note: See TracBrowser for help on using the repository browser.