/// <summary> /// Adds the book. /// </summary> /// <param name="book">The book.</param> public static void AddBook(Book book) { Book currentBook = books.FirstOrDefault(b => b.ID == book.ID); if (books.FirstOrDefault(b => b.ID == book.ID) == null) { books.Add(book); } }
/// <summary> /// Updates the book. /// </summary> /// <param name="id">The id.</param> /// <param name="book">The book.</param> public static void UpdateBook(string id, Book book) { Book bookToUpdate = books.FirstOrDefault(b => b.ID == id); if (bookToUpdate != null) { book.ID = id; books.Remove(bookToUpdate); books.Add(book); } }
/// <summary> /// Updates the book. /// </summary> /// <param name="id">The id.</param> /// <param name="book"></param> /// <returns></returns> public Book UpdateBook(string id, Book book) { BookRepository.UpdateBook(id, book); return book; }
/// <summary> /// Creates the book. /// </summary> /// <param name="book">The book.</param> /// <returns></returns> public Book CreateBook(Book book) { BookRepository.AddBook(book); return book; }