static void Main(string[] args) { // for test var client = new MongoClient(); var db = client.GetDatabase(nameDB); var mongo = new BookAccessor(nameDB); //var books = GetTestDataBooks(); //foreach (var book in books) //{ // mongo.AddBook<Book>(nameTable, book); //} //mongo.ShowNameBookCountMore1(nameTable, 3); //mongo.GetBookMinCount(nameTable); //mongo.GetBookMaxCount(nameTable); //mongo.GetBookWithoutAuthor(nameTable); //mongo.GetAllAuthor(nameTable); //mongo.AddOneCountAllBook(nameTable); //mongo.DeleteBookWhereCountLess(nameTable, 3); //mongo.DeleteAll(nameTable); //mongo.AddAdditionalGenge(nameTable, "fantasy", "favority"); Console.Read(); }
public List <Status> RetrieveStatusList() { try { return(BookAccessor.RetrieveStatusList()); } catch (Exception) { throw; } }
public List <Library> RetrieveLibraryList() { try { return(BookAccessor.RetrieveLibraryList()); } catch (Exception) { throw; } }
public List <Author> RetrieveAuthorList() { try { return(BookAccessor.RetrieveAuthorList()); } catch (Exception) { throw; } }
public bool HoldBook(Book book, string studentID) { bool result = false; try { result = (1 == BookAccessor.HoldBook(book.BookID, studentID)); } catch (Exception) { throw; } return(true); }
public bool DeleteBook(Book book) { bool result = false; try { result = (1 == BookAccessor.DeleteBook(book.BookID)); } catch (Exception) { throw; } return(true); }
public List <Book> RetrieveBookListByID(int bookID) { List <Book> bookDetail = null; try { bookDetail = BookAccessor.RetrieveBookListByID(bookID); } catch (Exception) { throw; } return(bookDetail); }
public Book RetrieveBookByID(int id) { Book bookDetail = null; try { bookDetail = BookAccessor.RetrieveBookByID(id); } catch (Exception) { throw; } return(bookDetail); }
public Book RetrieveBookByID(Book bookItem) { Book bookDetail = null; try { bookDetail = BookAccessor.RetrieveBookByID(bookItem.BookID); } catch (Exception) { throw; } return(bookDetail); }
public List <Book> RetrieveBookList(bool active = true) { List <Book> bookList = null; try { bookList = BookAccessor.RetrieveBookByActive(active); } catch (Exception) { throw; } return(bookList); }
public List <Book> RetrieveBookListByWord(string word) { List <Book> bookDetail = null; try { bookDetail = BookAccessor.RetrieveBookByWords(word); } catch (Exception) { throw; } return(bookDetail); }
/** * checks if the isbn already exists */ public bool CheckISBN(string isbn) { try { if (BookAccessor.CheckBookID(isbn) == 1) { return(true); } } catch (Exception) { throw; } return(false); }
public bool EditBook(Book book) { try { if (BookAccessor.UpdateBook(book)) { return(true); } } catch (Exception) { throw; } return(false); }
public bool DeleteBook(Book book, bool toRestore) { try { if (BookAccessor.InactivateBook(book, toRestore)) { return(true); } } catch (Exception) { throw; } return(false); }
public bool AddNewBook(Book book) { Console.WriteLine(book.Title); try { if (BookAccessor.InsertBook(book)) { return(true); } } catch (Exception) { throw; } return(false); }
public List <Book> GetBookListByAuthorID(int authorID) { try { var bookList = BookAccessor.FetchBookListByAuthorID(authorID); if (bookList.Count > 0) { return(bookList); } else { throw new ApplicationException("There were no records found."); } } catch (Exception) { throw; } }
public List <Book> GetBookList(Active group) { try { var bookList = BookAccessor.FetchBookList(group); if (bookList.Count > 0) { return(bookList); } else { throw new ApplicationException("There were no records found."); } } catch (ApplicationException) { throw new ApplicationException("There were no records found."); } }
public List <Book> GetBookListByTitle(string title) { try { var bookList = BookAccessor.FetchBookListByTitle(title); if (bookList.Count > 0) { return(bookList); } else { throw new ApplicationException("There were no records found."); } } catch (Exception) { throw; } }
public Book GetRentedBookByRentalID(int rentalID) { try { var book = BookAccessor.FetchBookByRentalID(rentalID); if (book != null) { return(book); } else { throw new ApplicationException("There were no records found."); } } catch (Exception) { throw; } }
public bool SaveNewBook(Book book) { var result = false; if (book.ISBN == "" || book.Title == "" || book.Edition == "" || book.EditionYear == 0 || book.CategoryID == null || book.AuthorID < 10000) { throw new ApplicationException("You must fill out all the fields."); } try { result = (0 != BookAccessor.InsertBook(book)); } catch (Exception) { throw; } return(result); }
public bool EditBook(Book book, Book oldBook, string updateType) { var result = false; if (book.ISBN == "" || book.Title == "" || book.Edition == "" || book.EditionYear < 800 || book.AuthorID < 100000) { throw new ApplicationException("You must fill out all the fields."); } try { result = (0 != BookAccessor.UpdateBook(book, oldBook, updateType)); } catch (Exception) { throw; } return(result); }