source: src/main/java/edu/gjoko/schedlr/controllers/RegisterController.java

Last change on this file was 1413ee2, checked in by gjoko kostadinov <gjokokostadinov@…>, 6 months ago

Add all bug fixes.

  • Property mode set to 100755
File size: 1.3 KB
Line 
1package edu.gjoko.schedlr.controllers;
2
3import edu.gjoko.schedlr.entity.Stakeholder;
4import edu.gjoko.schedlr.services.StakeholderService;
5import org.springframework.stereotype.Controller;
6import org.springframework.ui.Model;
7import org.springframework.web.bind.annotation.GetMapping;
8import org.springframework.web.bind.annotation.ModelAttribute;
9import org.springframework.web.bind.annotation.PostMapping;
10
11@Controller
12public class RegisterController {
13
14 private final StakeholderService stakeholderService;
15
16 public RegisterController(StakeholderService stakeholderService) {
17 this.stakeholderService = stakeholderService;
18 }
19
20 @GetMapping(path ="/register_customer")
21 public String getCustomerRegisterPage(Model model) {
22 model.addAttribute("stakeholder", new Stakeholder());
23 return "register_customer";
24 }
25
26 @PostMapping(path = "/register_customer")
27 public String registerCustomer(@ModelAttribute Stakeholder customer, Model model) {
28 stakeholderService.saveStakeholder(customer);
29 return "redirect:login";
30 }
31
32 @GetMapping(path = "/register_business")
33 public String getBusinessRegisterPage(Model model) {
34 return "register_business";
35 }
36
37 @PostMapping(value = "/register_business")
38 public String registerBusiness(Model model) {
39 return "redirect:login";
40 }
41}
Note: See TracBrowser for help on using the repository browser.