Commit db47cdec authored by s7_spruge_k's avatar s7_spruge_k
Browse files

Basic controllers for views

parent 7aa8f395
package com.example.calendar.controller;
import java.time.LocalDate;
import java.time.LocalTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import com.example.calendar.repo.UserRepo;
@Controller
public class CalendarController {
@Autowired
UserRepo userRepo;
@GetMapping(value = "/month-view")
public String monthViewGet(Model models)
{
models.addAttribute("currentTime", LocalTime.now());
models.addAttribute("currentDate", LocalDate.now());
models.addAttribute("currentMonth", LocalDate.now().getMonth());
//TODO how to pass User?
return "monthView";
}
@GetMapping(value = "/week-view")
public String weekViewGet(Model models)
{
models.addAttribute("currentTime", LocalTime.now());
models.addAttribute("currentDate", LocalDate.now());
models.addAttribute("currentMonth", LocalDate.now().getMonth());
//TODO how to pass User?
return "weekView";
}
@GetMapping(value = "/day-view")
public String dayViewGet(Model models)
{
models.addAttribute("currentTime", LocalTime.now());
models.addAttribute("currentDate", LocalDate.now());
models.addAttribute("currentMonth", LocalDate.now().getMonth());
models.addAttribute("currentDay", LocalDate.now().getDayOfWeek());
//TODO how to pass User?
return "dayView";
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment