Esempio n. 1
0
 /// <summary>
 /// the customSearch method, used to find a book based on its ISBN.
 /// </summary>
 /// <param name="searchItem">ISBN</param>
 /// <returns>Book with the ISBN if it exists</returns>
 public Book CustomSearch(string searchItem)
 {
     if (bookRepo.All().Where(b => b.Isbn == searchItem) != null)
     {
         return(bookRepo.All().Where(b => b.Isbn == searchItem).First());
     }
     else
     {
         throw new InputNotFoundException();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Returns all the books from the database
 /// </summary>
 /// <returns></returns>
 public IEnumerable <Book> All()
 {
     return(bookRepository.All());
 }
Esempio n. 3
0
 /// <summary>
 /// Get all books from database.
 /// </summary>
 /// <returns>A list of all books in database.</returns>
 public IEnumerable <Book> All()
 {
     return(BookRepository.All().OrderBy(book => book.Title));
 }
Esempio n. 4
0
 /// <summary>
 /// return all books
 /// </summary>
 /// <returns></returns>
 public IEnumerable <Book> All()
 {
     return(bookRepository.All().OrderByDescending(book => book.Id));
 }