[204464d] | 1 | package edu.gjoko.schedlr.controllers;
|
---|
| 2 |
|
---|
| 3 | import edu.gjoko.schedlr.entity.Stakeholder;
|
---|
| 4 | import edu.gjoko.schedlr.services.StakeholderService;
|
---|
| 5 | import org.springframework.stereotype.Controller;
|
---|
| 6 | import org.springframework.ui.Model;
|
---|
| 7 | import org.springframework.web.bind.annotation.GetMapping;
|
---|
| 8 | import org.springframework.web.bind.annotation.ModelAttribute;
|
---|
| 9 | import org.springframework.web.bind.annotation.PostMapping;
|
---|
| 10 |
|
---|
| 11 | @Controller
|
---|
| 12 | public class RegisterController {
|
---|
| 13 |
|
---|
| 14 | private final StakeholderService stakeholderService;
|
---|
| 15 |
|
---|
| 16 | public RegisterController(StakeholderService stakeholderService) {
|
---|
| 17 | this.stakeholderService = stakeholderService;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
[46fd0c7] | 20 | @GetMapping(path ="/register_customer")
|
---|
[204464d] | 21 | public String getCustomerRegisterPage(Model model) {
|
---|
| 22 | model.addAttribute("stakeholder", new Stakeholder());
|
---|
| 23 | return "register_customer";
|
---|
| 24 | }
|
---|
| 25 |
|
---|
[46fd0c7] | 26 | @PostMapping(path = "/register_customer")
|
---|
[204464d] | 27 | public String registerCustomer(@ModelAttribute Stakeholder customer, Model model) {
|
---|
[8bcd64c] | 28 | stakeholderService.saveStakeholder(customer);
|
---|
[a436340] | 29 | return "redirect:login";
|
---|
[204464d] | 30 | }
|
---|
| 31 |
|
---|
[46fd0c7] | 32 | @GetMapping(path = "/register_business")
|
---|
[204464d] | 33 | public String getBusinessRegisterPage(Model model) {
|
---|
| 34 | return "register_business";
|
---|
| 35 | }
|
---|
| 36 |
|
---|
[763289e] | 37 | @PostMapping(value = "/register_business")
|
---|
[204464d] | 38 | public String registerBusiness(Model model) {
|
---|
[46fd0c7] | 39 | return "redirect:login";
|
---|
[204464d] | 40 | }
|
---|
| 41 | }
|
---|