Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
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.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.userFront.domain.Appointment;
import com.userFront.domain.User;
Expand All @@ -27,7 +28,7 @@ public class AppointmentController {
@Autowired
private UserService userService;

@RequestMapping(value = "/create", method = RequestMethod.GET)
@GetMapping("/create")
public String createAppointment(Model model) {
Appointment appointment = new Appointment();
model.addAttribute("appointment", appointment);
Expand All @@ -36,7 +37,7 @@ public String createAppointment(Model model) {
return "appointment";
}

@RequestMapping(value = "/create", method = RequestMethod.POST)
@PostMapping("/create")
public String createAppointmentPost(@ModelAttribute("appointment") Appointment appointment,
@ModelAttribute("dateString") String date, Model model, Principal principal) throws ParseException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
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.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.userFront.domain.User;
import com.userFront.service.UserService;
Expand All @@ -19,7 +20,7 @@ public class UserController {
@Autowired
private UserService userService;

@RequestMapping(value = "/profile", method = RequestMethod.GET)
@GetMapping("/profile")
public String profile(Principal principal, Model model) {
User user = userService.findByUsername(principal.getName());

Expand All @@ -28,7 +29,7 @@ public String profile(Principal principal, Model model) {
return "profile";
}

@RequestMapping(value = "/profile", method = RequestMethod.POST)
@PostMapping("/profile")
public String profilePost(@ModelAttribute("user") User newUser, Model model) {
User user = userService.findByUsername(newUser.getUsername());
user.setUsername(newUser.getUsername());
Expand Down