Esempio n. 1
0
def delete_book():
    book_id = ui.ask_question('Enter the book ID: ')
    book = store.get_book_by_id(book_id)
    try:
        store.delete_book(book)
    except:
        print("Error: Book Not Found")
Esempio n. 2
0
def search_book():
    # while true:
    search_term = ui.ask_question(
        'Enter search term, will match partial authors or titles.')
    # if(not search_term):
    #     print("You cannot enter in a blank string")
    # else:
    #     break
    matches = store.book_search(search_term)
    ui.show_books(matches)
Esempio n. 3
0
def search_book():

    search_term = ui.ask_question(
        'Enter search term, will match partial authors or titles.')
    if search_term == None:

        print('Nothing was entered try again')

    else:
        matches = store.book_search(search_term)
        ui.show_books(matches)
Esempio n. 4
0
def delete_book():
    try:
        book_id = ui.get_book_id()
        book = store.get_book_by_id(book_id)
        answer = ui.ask_question("Type DELETE to confirm you'd like to delete this book: ")
        if answer == "DELETE":
            Book.delete(book)
        else:
            ui.message("Returning to main menu. Book has not been deleted.")
    except:
        ui.message('Error - book not found with that ID')
Esempio n. 5
0
 def ask_question(self, mock_print, mock_input):
     self.assertEqual('pizza',
                      ui.ask_question('What is your favorite food?'))
     mock_print.assert_called_with('What is your favorite food?')
Esempio n. 6
0
def search_book():
    search_term = ui.ask_question(
        'Enter search term, will match partial authors or titles.')
    matches = store.book_search(search_term)
    ui.show_books(matches)
Esempio n. 7
0
def search_for_an_artist():
    search_term = ui.ask_question('Enter search term, will match partial names or emails.')
    matches = store.artist_search(search_term)
    ui.show_artists(matches)
Esempio n. 8
0
def delete_book():
    search_term = ui.ask_question('Enter book ID:   '   ) 
    matches = store.book_search(search_term)
    ui.show_books(matches) # Corrected "show_book" to "show_books"
Esempio n. 9
0
def delete_artwork():
    art_to_delete = ui.ask_question('Enter name of Artwork to delete: ')
    db.delete_artwork(art_to_delete)
Esempio n. 10
0
def show_available_art_by_artist():
    search_term = ui.ask_question(
        'Enter name of Artist to view their available works: ')
    available_art = db.get_available_art_by_artist(search_term)
    ui.show_artwork(available_art)
Esempio n. 11
0
def show_all_art_by_artist():
    search_term = ui.ask_question('Enter name of Artist to view their works: ')
    matches = db.artist_art_search(search_term)
    ui.show_artwork(matches)
Esempio n. 12
0
def search_book():
    """ searches book in the database then displays it"""
    search_term = ui.ask_question(
        'Enter search term, will match partial authors or titles.')
    matches = store.book_search(search_term)
    ui.show_books(matches)
Esempio n. 13
0
def searh_artwork():
    search_artwork = ui.ask_question('Enter artwork name: ')
    art = store.get_artwork_by_name(search_artwork)
    ui.show_all_artwork(art)
Esempio n. 14
0
def search_artwork():
    search_term = ui.ask_question('Enter search term, will match partial name or email')
    matches = artworkstore.search_artwork(search_term)
    ui.show_artworks(matches)