Ignore:
Timestamp:
02/01/23 22:35:56 (21 months ago)
Author:
Gjoko <goko_kostadinov@…>
Branches:
master
Children:
cc52b09
Parents:
044bd76
Message:

Adding search by date on homepage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/edu/gjoko/schedlr/controllers/HomePageController.java

    r044bd76 r9280859  
    11package edu.gjoko.schedlr.controllers;
    22
     3import edu.gjoko.schedlr.entity.Search;
    34import org.springframework.stereotype.Controller;
    45import org.springframework.ui.Model;
    56import org.springframework.web.bind.annotation.GetMapping;
     7import org.springframework.web.bind.annotation.ModelAttribute;
    68import org.springframework.web.bind.annotation.PostMapping;
    79
     
    1012
    1113    @GetMapping(name = "/homepage")
    12     public String getHomePageTemplate(Model model) {
     14    public String getHomePageTemplate(Model model, @ModelAttribute("search")Search search ) {
     15        model.addAttribute("search", search);
    1316        return "homepage";
    1417    }
    1518
    1619    @PostMapping(name = "/homepage")
    17     public String postHomePageTemplate(Model model) {
     20    public String postHomePageTemplate(Model model, @ModelAttribute("search")Search search) {
     21        model.addAttribute("search", search);
     22        return "homepage";
     23    }
     24
     25    @GetMapping("/search")
     26    public String getAppointments(Model model, @ModelAttribute("search")Search search) {
     27        model.addAttribute("search", search);
    1828        return "homepage";
    1929    }
Note: See TracChangeset for help on using the changeset viewer.