public void DeleteCollection(int id) { try { List<Book> books = helper.Books().queryForEq("Collection", id); Collection defColl = helper.Collections().queryForEq("Name", "д╛хо").get(0); for (Book book : books) { book.setCollection(defColl.getId()); helper.Books().update(book); } helper.Collections().deleteById(id); } catch (SQLException e) { e.printStackTrace(); } }
public void DeleteBook(Book book) { try { helper.Books().delete(book); } catch (SQLException e) { e.printStackTrace(); } }
public void DeleteBook(int id) { try { helper.Books().deleteById(id); } catch (SQLException e) { e.printStackTrace(); } }
public void AddBook(Book book) { try { helper.Books().create(book); } catch (SQLException e) { e.printStackTrace(); } }
public List<Book> GetAllBooks() { try { return helper.Books().queryForAll(); } catch (SQLException e) { e.printStackTrace(); } return null; }
public List<Book> GetBooks(int collection) { try { return helper.Books().queryForEq("Collection", collection); } catch (SQLException e) { e.printStackTrace(); } return null; }
public Book GetBook(int id) { try { return helper.Books().queryForId(id); } catch (SQLException e) { e.printStackTrace(); } return null; }