@RequestMapping(value="/creditCardRequest")
public synchronized ModelAndView creditCardRequest(Principal principal) {
String name = principal.getName();
ExternalAccount currentuser = extBo.findAccountByName(name);
// Query the credit card request stable to find the request for the account number
CreditcardRequests creditCardCheck = ccreqsBo.checkForCreditCardNumber(currentuser.getAccountNo());
//if user populate with row
if(creditCardCheck != null)
{
ModelAndView modelAndView = new ModelAndView("IndividualUserCreditCardRequest");
modelAndView.addObject("creditCard", creditCardCheck);
return modelAndView;
}
//If no credit new request and add to credit card request
else{
CreditcardRequests creditCardNewRequest = new CreditcardRequests();
creditCardNewRequest.setApproved("no");
creditCardNewRequest.setAccountNo(currentuser.getAccountNo());
ccreqsBo.save(creditCardNewRequest);
ModelAndView modelAndView = new ModelAndView("IndividualUserCreditCardRequest");