Beispiel #1
0
        protected void borrowBtn_Click(object sender, EventArgs e)
        {
            //Get data of the current trading
            string index          = Request.Params["pointerId"].ToString();
            int    indexOfTrading = int.Parse(index);
            //Get id of trading
            Trading currentChosen = tradings[indexOfTrading];
            int     tradingId     = currentChosen.Id;

            /*Update borrower*/
            //Get id of borrower = current user in sessionId
            int borrowerId = user.Id;

            //Change tradingStatus to pending
            currentChosen.TradingStatus = 1;
            //Update borrowerId
            currentChosen.BorrowerID = borrowerId;

            //Update in database
            TradingDAO tradingDAO = new TradingDAO();

            tradingDAO.Update(tradingId, currentChosen);

            //Reload page
            Server.Transfer("BookDetail.aspx");
        }