private void btn_loan_Click(object sender, EventArgs e) //Button loan book { int i = grid_results_adm.CurrentRow.Index; string isbn = grid_results_adm["Isbn", i].Value.ToString(); int copy = (int)grid_results_adm["CopyNbr", i].Value; BibliotechController bc = new BibliotechController(); bc.LoanBook(isbn, copy, us.UserId); FillViewBooks(); }
private void btn_userloan_Click(object sender, EventArgs e) { int i = grid_results.CurrentRow.Index; string isbn = grid_results["Isbn", i].Value.ToString(); int copy = (int)grid_results["CopyNbr", i].Value; BibliotechController bc = new BibliotechController(); BibliotechDAL bd = new BibliotechDAL(); int s = bd.CheckAvailability(isbn, copy); if (s == 1) { MessageBox.Show("Boken är utlånad"); } else { bc.LoanBook(isbn, copy, us.UserId); ShowLoans(); } }