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