@RequestMapping(
      value = "/sell/{stockname}/{stockid}/{numberofshares}",
      method = RequestMethod.POST)
  public String sellShares(
      @PathVariable("numberofshares") int numberofshares,
      @PathVariable("stockid") int stockid,
      @PathVariable("stockname") String stockname,
      HttpServletRequest request,
      ModelMap model,
      @ModelAttribute("sellStocks") SellStocks sellStocks,
      BindingResult result) {

    users user = (users) request.getSession().getAttribute("Users");
    sellStocks.setUser(user);
    sellStocks.setStockname(stockname);
    sellStocks.setStatus("N");
    // sellStocks.setNoofshares(noofshares)
    int y = sellStocks.getNoofshares();
    int x = numberofshares - y;
    System.out.println(String.valueOf(x));

    int xy = sellingTableInterfaceService.addSellShareDetails(sellStocks);
    stockPortfolioIInterfaceService.updateStockPortfolio(x, stockid);

    return "redirect:/Client/viewmyaccount";
  }
  @RequestMapping(
      value = "/buy/{stockname}/{id}/{sellprice}/{buyeruserid}",
      method = RequestMethod.POST)
  public String sellShares(
      @PathVariable("stockname") String stockname,
      @PathVariable("id") int sellingtableuniqueid,
      @PathVariable("sellprice") String sellprice,
      @PathVariable("buyeruserid") String buyeruserid,
      HttpServletRequest request,
      ModelMap model,
      @ModelAttribute("Transaction") Transaction transaction,
      BindingResult result) {

    List<SellStocks> x = sellingTableInterfaceService.listsellshs(sellingtableuniqueid);

    SellStocks u_r = x.get(0);
    users u = u_r.getUser();

    users us = (users) request.getSession().getAttribute("Users");
    Integer amount = Integer.valueOf(sellprice);

    transaction.setAmountpaid(amount);
    transaction.setBuyTableID(sellingtableuniqueid);
    transaction.setStockname(stockname);
    DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    transaction.setDateoftransaction(new Date());
    transaction.setUse(us);
    transaction.setUser(u);

    int results = transactionServiceInterface.addTransaction(transaction);

    // sellingTableInterfaceService.

    // listsellshs
    List<SellStocks> xyu = sellingTableInterfaceService.listsellshs(sellingtableuniqueid);

    SellStocks ui = xyu.get(0);

    sellingTableInterfaceService.updatesellShares(sellingtableuniqueid);
    users loggeduser = (users) request.getSession().getAttribute("Users");

    confirmationpage cp = new confirmationpage();
    cp.setAmount(amount);
    cp.setNumberofshares(ui.getNoofshares());
    cp.setStockname(stockname);
    cp.setTransactionnumber(results);
    cp.setUsername(us.getUSER_ID());

    model.addAttribute("Confirmation", cp);
    String amounts = String.valueOf(cp.getAmount());
    model.addAttribute("amounts", amounts);

    // ..updatesellShares(int id)

    return "confirmationpage";
  }