/// <summary> /// Add new <see cref="Book"/> to list.. /// </summary> /// <param name="b"><see cref="Book"/> instance.</param> public void AddBook(Book b) { try { if (this.books.Find(c => (c.Author == b.Author) && (c.Name == b.Name)) != null) { throw new BookException("This book is already exist."); } else { this.books.Add(b); BookListStorage.AddToFile(b); Program.Logger.Info("The book is successfully added."); } } catch (BookException ex) { Program.Logger.Error(ex.Message); } }
/// <summary> /// Add new <see cref="Book"/> to list.. /// </summary> /// <param name="b"><see cref="Book"/> instance.</param> public void AddBook(Book b) { try { if (this.books.Find(c => (c.Author == b.Author) && (c.Name == b.Name)) != null) { throw new BookException("This book is already exist."); } else { this.books.Add(b); BookListStorage.AddToFile(b); Console.WriteLine("The book is successfully added."); Console.WriteLine(); } } catch (BookException ex) { Console.WriteLine(ex.Message); } }