Search in sources :

Example 6 with Todo

use of softuni.todolist.entity.Todo in project SoftUni by kostovhg.

the class TodoController method details.

@GetMapping("/todo/{id}")
public String details(Model model, @PathVariable Integer id) {
    if (!this.todoRepository.exists(id)) {
        return "redirect:/";
    }
    Todo todo = this.todoRepository.findOne(id);
    model.addAttribute("todo", todo);
    model.addAttribute("view", "todo/details");
    return "base-layout";
}
Also used : Todo(softuni.todolist.entity.Todo) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

Todo (softuni.todolist.entity.Todo)6 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)5 GetMapping (org.springframework.web.bind.annotation.GetMapping)3 PostMapping (org.springframework.web.bind.annotation.PostMapping)3 UserDetails (org.springframework.security.core.userdetails.UserDetails)1 User (softuni.todolist.entity.User)1