protected void Page_Load(object sender, EventArgs e) { HistoryBAL booksLogic = new HistoryBAL(); BooksHistory.DataSource = booksLogic.GetData(); BooksHistory.DataBind(); }
protected void ReturnBook_Click(object sender, EventArgs e) { if (Session["email"] != null) { int book_id = Convert.ToInt32(ReturnBookID.Text); HistoryBAL historyLogic = new HistoryBAL(); bool result = historyLogic.UpdateEntry((string)(Session["email"]), book_id); if (result == true) { TestLabel.Text = "Book returned!"; } //TestLabel.Text = result.ToString(); } else { TestLabel.Text = "You are not logged in"; } }
//Only for logged useres! protected void TakeBook_Click(object sender, EventArgs e) { if (Session["email"] != null) { int book_id = Convert.ToInt32(TakeBookID.Text); HistoryBAL historyLogic = new HistoryBAL(); bool result = historyLogic.AddEntry((string)(Session["email"]), book_id); if (result == true) { TestLabel.Text = "Book taken!"; } else { TestLabel.Text = "Zero books left"; } } else { TestLabel.Text = "You are not logged in"; } }