Skip to content
Snippets Groups Projects

Ready to merge - Database

Merged Rhys Nute requested to merge database into main
21 files
+ 206
23
Compare changes
  • Side-by-side
  • Inline
Files
21
@@ -7,23 +7,38 @@ import org.springframework.web.servlet.ModelAndView;
import java.util.*;
@Controller
public class UserController {
private List<user> users = List.of(
new user (1, "Mrs", "Hannah", "English", "hannah.english@gmail.com"),
new user (2, "Mr", "Tom", "Harper", "tom.harper2@gmail.com"),
new user (3, "Mrs", "Sarah", "Burton", "sarahburton@gmail.com"),
new user (4, "Mr", "Nigel", "Hopkins", "nigelahopkins@gmail.com")
);
public class DatabaseController {
@Autowired
private UserRepository userRepository;
// @Autowired
// private locationRepository locationRepository;
// @Autowired
// private trailsRepository trailsRepository;
// public DatabaseController() {
//
// }
@GetMapping("/userList")
public ModelAndView userList(){
ModelAndView mav = new ModelAndView("usersData.sql");
public ModelAndView userList() {
ModelAndView mav = new ModelAndView("towns/userData");
List<user> users = userRepository.getAllUsers();
mav.addObject("users", users);
return mav;
}
// @GetMapping("/trailList")
// public ModelAndView trailList() {
// ModelAndView mav1 = new ModelAndView("towns/trailsData");
// List<trail> trail = trailsRepository.getAllTrails();
// mav1.addObject("trails", trail);
// return mav1;
// }
// @GetMapping("locationList")
// public ModelAndView locationList(){
// ModelAndView mav2 = new ModelAndView("towns/locationData");
// List<location> location = locationRepository.getAllLocations();
// mav2.addObject("location", location);
// return mav2;
// }
}
Loading