mirror of
https://gitlab.com/etc404/software-engineering-project.git
synced 2026-05-10 20:52:58 +00:00
Update 16 files
- /src/main/resources/templates/create-account.html - /src/main/resources/templates/my-profile.html - /src/main/resources/templates/home.html - /src/main/resources/templates/update-recipe.html - /src/main/resources/templates/explore.html - /src/main/resources/templates/public-profile.html - /src/main/java/com/example/demo/controller/SiteController.java - /src/main/java/com/example/demo/controller/ProfileController.java - /src/main/java/com/example/demo/dto/UserDto.java - /src/main/java/com/example/demo/dto/UpdateProfileDto.java - /src/main/java/com/example/demo/dto/ProfileDto.java - /src/main/java/com/example/demo/service/Impl/RecipeServiceImpl.java - /src/main/java/com/example/demo/service/Impl/UserServiceImpl.java - /src/main/java/com/example/demo/service/UserService.java - /src/main/java/com/example/demo/config/SecurityConfig.java - /src/main/java/com/example/demo/entity/User.java
This commit is contained in:
@@ -2,10 +2,8 @@ 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;
|
||||
@@ -20,10 +18,10 @@ public class SiteController {
|
||||
public SiteController(RecipeService recipeService) {
|
||||
this.recipeService = recipeService;
|
||||
}
|
||||
|
||||
@GetMapping("/")
|
||||
public String viewHomePage(Model model) {
|
||||
//model.addAttribute("allemplist", employeeServiceImpl.getAllEmployee());
|
||||
List<RecipeDto> recipes = recipeService.getAllRecipes();
|
||||
List<RecipeDto> recipes = recipeService.getAllRecipes();
|
||||
model.addAttribute("recipes", recipes);
|
||||
return "home";
|
||||
}
|
||||
@@ -49,14 +47,13 @@ public class SiteController {
|
||||
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";
|
||||
// }
|
||||
|
||||
@GetMapping("/recipes/{id}/edit")
|
||||
public String viewEditRecipePage(@PathVariable Integer id, Model model) {
|
||||
RecipeDto recipe = recipeService.getRecipeById(id);
|
||||
model.addAttribute("recipe", recipe);
|
||||
return "update-recipe";
|
||||
}
|
||||
|
||||
@GetMapping("/explore")
|
||||
public String explore(
|
||||
@@ -69,13 +66,8 @@ public class SiteController {
|
||||
) {
|
||||
List<RecipeDto> recipes = recipeService.getRecipes(q, tags, prices, cookTime, prepTime);
|
||||
model.addAttribute("recipes", recipes);
|
||||
String displayQuery = q;
|
||||
|
||||
|
||||
model.addAttribute("q", q);
|
||||
model.addAttribute("tags", tags);
|
||||
return "explore";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user