source: src/main/java/com/example/medweb/web/RegisterController.java

Last change on this file was e5fefbd, checked in by Anita Terziska <63020646+Nit4e@…>, 2 years ago

initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1package com.example.medweb.web;
2
3import com.example.medweb.model.Pacient;
4import com.example.medweb.service.PacientService;
5import org.springframework.stereotype.Controller;
6import org.springframework.ui.Model;
7import org.springframework.web.bind.annotation.GetMapping;
8import org.springframework.web.bind.annotation.PostMapping;
9
10import java.util.Random;
11
12
13@Controller
14public class RegisterController {
15
16
17 private final PacientService pacientService;
18
19 public RegisterController(PacientService pacientService) {
20
21 this.pacientService = pacientService;
22 }
23
24 // prikaz na templejtot za registracija
25 @GetMapping ("/register")
26 public String showRegisterForm(Pacient pacient, Model model){
27
28 return "register.html";
29 }
30
31 // zachuvuvanje na noviot registriran pacient vo baza i prikaz na welcome stranata
32 @PostMapping("/save")
33 public String register(Pacient pacient, Model model){
34 model.addAttribute("pacient", pacient);
35 this.pacientService.save(pacient);
36 return "welcome.html";
37 }
38}
39
Note: See TracBrowser for help on using the repository browser.