private void btnSearchByBookTitle_Click(object sender, EventArgs e) { var bookmodels = EntityBroker.getBookModelByTitle(txtSearchByBookTitle.Text); dt.Rows.Clear(); foreach (BooksModel bookmodel in bookmodels) { dt.Rows.Add( bookmodel.BookTitle, EntityBroker.getNumberOfBooksInLibraryByBookModelID(bookmodel.BookModelId), EntityBroker.getNumberOfAvaiableBooksToRentInLibraryByBookModelID(bookmodel.BookModelId), bookmodel.Author, bookmodel.BookCategory, bookmodel.MaxAvailableDayToRent, bookmodel.BookModelId ); } dgvBooksList.DataSource = dt; }
private void ucListBooks_Load(object sender, EventArgs e) { var bookmodels = EntityBroker.getBooksModels(); dt.Rows.Clear(); foreach (BooksModel bookmodel in bookmodels) { dt.Rows.Add( bookmodel.BookTitle, EntityBroker.getNumberOfBooksInLibraryByBookModelID(bookmodel.BookModelId), EntityBroker.getNumberOfAvaiableBooksToRentInLibraryByBookModelID(bookmodel.BookModelId), bookmodel.Author, bookmodel.BookCategory, bookmodel.MaxAvailableDayToRent, bookmodel.BookModelId ); } dgvBooksList.DataSource = dt; dgvBooksList.Refresh(); }