Exemple #1
0
        /// <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);
        }
Exemple #2
0
        public void Remove(Book bok)
        {
            EventArgs ev = new EventArgs();

            _bookRepository.Remove(bok);
            OnChanged(this, ev);
        }
Exemple #3
0
 public void RemoveBook(Book book)
 {
     bookRepository.Remove(book);
     if (Updated != null)
     {
         Updated(this, EventArgs.Empty);
     }
 }
Exemple #4
0
 /// <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();
     }
 }
Exemple #5
0
 /// <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);
 }
Exemple #6
0
 public void Remove(Book b)
 {
     bookRepository.Remove(b);
     OnUpdate();
 }
Exemple #7
0
 /// <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);
 }
Exemple #8
0
 public void Remove(Book book)
 {
     _bookRepository.Remove(book);
     OnUpdate(new EventArgs());
 }
Exemple #9
0
 /// <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);
 }
Exemple #10
0
 public void RemoveBook(Book book)
 {
     _bookRepository.Remove(book);
 }