[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Delete, true)] public bool
DeleteBook(int bookid) { // Delete book
record int rowsAffected = Adapter.Delete(bookid);
// return true if one row
deleted return rowsAffected == 1; }
public bool
UpdateBook(int bookid, string isbn, string title, string author, string status, string loaned, string series,
string description) { BookDataSet.BookDataTable books =
Adapter.GetBookByBookID(bookid); if (books.Count == 0) return false; // no matching record found,
return false else { BookDataSet.BookRow book = books[0]; book.ISBN = isbn;
book.Title = title; book.Author = author; book.Status = status;
if (loaned
== null) book.SetLoanedNull(); else book.Loaned = loaned; if (series == null) book.SetSeriesNull(); else book.Series = series; if (description == null) book.SetDescriptionNull(); else book.Description = description; // Update book
record
int rowsAffected = Adapter.Update(book);
// Return true if one row
updated return rowsAffected == 1;
}
|