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

Last change on this file since 46fd0c7 was 46fd0c7, checked in by Gjoko Kostadinov <gjoko.kostadinov@…>, 16 months ago

Add admin page initial work.

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