The Unpopular Decision

This commit is contained in:
etc404
2026-04-16 17:49:41 -06:00
parent cefc69bd33
commit 6663539011
82 changed files with 5772 additions and 0 deletions
@@ -0,0 +1,60 @@
package com.example.demo.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.demo.service.RecipeService;
import com.example.demo.dto.RecipeDto;
import com.example.demo.entity.Recipe;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@Controller
public class SiteController {
private final RecipeService recipeService;
public SiteController(RecipeService recipeService) {
this.recipeService = recipeService;
}
@GetMapping("/")
public String viewHomePage(Model model) {
//model.addAttribute("allemplist", employeeServiceImpl.getAllEmployee());
List<RecipeDto> recipes = recipeService.getAllRecipes();
model.addAttribute("recipes", recipes);
return "home";
}
@GetMapping("/login")
public String viewLoginPage(Model model) {
return "login";
}
@GetMapping("/register")
public String viewRegisterPage(Model model) {
return "create-account";
}
@GetMapping("/create")
public String viewCreatePage(Model model) {
return "create-recipe";
}
@GetMapping("/recipes/{id}")
public String viewRecipe(@PathVariable Integer id, Model model) {
RecipeDto recipe = recipeService.getRecipeById(id);
model.addAttribute("recipe", recipe);
return "view-recipe";
}
@GetMapping("/explore")
public String viewExplorePage(Model model) {
//model.addAttribute("allemplist", employeeServiceImpl.getAllEmployee());
List<RecipeDto> recipes = recipeService.getAllRecipes();
model.addAttribute("recipes", recipes);
return "explore";
}
}