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 @@ -6,9 +6,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.PrimaryAccount;
import com.userFront.domain.PrimaryTransaction;
Expand All @@ -32,7 +33,7 @@ public class AccountController {
@Autowired
private TransactionService transactionService;

@RequestMapping("/primaryAccount")
@GetMapping("/primaryAccount")
public String primaryAccount(Model model, Principal principal) {
List<PrimaryTransaction> primaryTransactionList = transactionService
.findPrimaryTransactionList(principal.getName());
Expand All @@ -46,7 +47,7 @@ public String primaryAccount(Model model, Principal principal) {
return "primaryAccount";
}

@RequestMapping("/savingsAccount")
@GetMapping("/savingsAccount")
public String savingsAccount(Model model, Principal principal) {
List<SavingsTransaction> savingsTransactionList = transactionService
.findSavingsTransactionList(principal.getName());
Expand All @@ -59,31 +60,31 @@ public String savingsAccount(Model model, Principal principal) {
return "savingsAccount";
}

@RequestMapping(value = "/deposit", method = RequestMethod.GET)
@GetMapping("/deposit")
public String deposit(Model model) {
model.addAttribute("accountType", "");
model.addAttribute("amount", "");

return "deposit";
}

@RequestMapping(value = "/deposit", method = RequestMethod.POST)
@PostMapping("/deposit")
public String depositPOST(@ModelAttribute("amount") String amount,
@ModelAttribute("accountType") String accountType, Principal principal) {
accountService.deposit(accountType, Double.parseDouble(amount), principal);

return "redirect:/userFront";
}

@RequestMapping(value = "/withdraw", method = RequestMethod.GET)
@GetMapping("/withdraw")
public String withdraw(Model model) {
model.addAttribute("accountType", "");
model.addAttribute("amount", "");

return "withdraw";
}

@RequestMapping(value = "/withdraw", method = RequestMethod.POST)
@PostMapping("/withdraw")
public String withdrawPOST(@ModelAttribute("amount") String amount,
@ModelAttribute("accountType") String accountType, Principal principal) {
accountService.withdraw(accountType, Double.parseDouble(amount), principal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.PostMapping;

import com.userFront.dao.RoleDao;
import com.userFront.domain.PrimaryAccount;
Expand All @@ -27,17 +27,17 @@ public class HomeController {
@Autowired
private RoleDao roleDao;

@RequestMapping("/")
@GetMapping("/")
public String home() {
return "redirect:/index";
}

@RequestMapping("/index")
@GetMapping("/index")
public String index() {
return "index";
}

@RequestMapping(value = "/signup", method = RequestMethod.GET)
@GetMapping("/signup")
public String signup(Model model) {
User user = new User();

Expand All @@ -46,7 +46,7 @@ public String signup(Model model) {
return "signup";
}

@RequestMapping(value = "/signup", method = RequestMethod.POST)
@PostMapping("/signup")
public String signupPost(@ModelAttribute("user") User user, Model model) {

if (userService.checkUserExists(user.getUsername(), user.getEmail())) {
Expand All @@ -70,7 +70,7 @@ public String signupPost(@ModelAttribute("user") User user, Model model) {
}
}

@RequestMapping("/userFront")
@GetMapping("/userFront")
public String userFront(Principal principal, Model model) {
User user = userService.findByUsername(principal.getName());
PrimaryAccount primaryAccount = user.getPrimaryAccount();
Expand Down