/// <summary> /// Removes book from database and removes the books authors if no other books are connected to the author. /// </summary> /// <param name="b">Book to be removed from Database.</param> public void Remove(Book b) { // Searches all authors the book is connected to, to see if they are connected to another book, otherwise, remove the author from DB. for (int i = b.Authors.Count() - 1; i >= 0; i--) { bool keepAuthor = false; foreach (Book ab in All()) // Search all books for the specific author. { if (ab != b) // Dont match if the currently searching book is the same as the book about to be removed. { if (ab.Authors.Contains(b.Authors[i])) { keepAuthor = true; } } } if (keepAuthor == false) { authorRepository.Remove(b.Authors[i]); } } bookRepository.Remove(b); var e = EventArgs.Empty; OnUpdated(e); }
public void Remove(Book bok) { EventArgs ev = new EventArgs(); _bookRepository.Remove(bok); OnChanged(this, ev); }
public void RemoveBook(Book book) { bookRepository.Remove(book); if (Updated != null) { Updated(this, EventArgs.Empty); } }
/// <summary> /// Removes a book and raises the OnChanged() event. /// </summary> /// <param name="b">Book to be removed</param> public void Remove(Book b) { if (b != null) { bookRepository.Remove(b); OnChanged(EventArgs.Empty); } else { throw new ArgumentNullException(); } }
/// <summary> /// Removes a book from the repository /// </summary> /// <param name="book">The book to be removed</param> public void Remove(Book book) { bookRepository.Remove(book); OnUpdated(this, eventArgs); }
public void Remove(Book b) { bookRepository.Remove(b); OnUpdate(); }
/// <summary> /// The remove method, removes a book from the Database /// </summary> /// <param name="item">Book to remove</param> public void Remove(Book item) { bookRepo.Remove(item); OnUpdated(EventArgs.Empty); }
public void Remove(Book book) { _bookRepository.Remove(book); OnUpdate(new EventArgs()); }
/// <summary> /// Removes a specific book from database. /// </summary> /// <param name="book">Book object to be removed.</param> public void Remove(Book book) { BookRepository.Remove(book); OnUpdated(book, EventArgs.Empty); }
public void RemoveBook(Book book) { _bookRepository.Remove(book); }