def delete_publisher(self): publishers = fetchProcedures.fetchPublishers() publishers = string_utils.build_input_options(self, publishers) self.choice = input("Which publisher would you like to delete?\n" + publishers) self.store["pubId"] = self.grabId() # DELETE PUBLISHER BY ID HERE deleteProcedures.deletePublisher(self.store["pubId"]) print("Deleted publisher")
def add_book(self): self.store["title"] = input( "What is the title of the book you want to add?\n") publishers = fetchProcedures.fetchPublishers() publishers = string_utils.build_input_options(self, publishers) self.choice = input("And who published this book?\n" + publishers) self.store["publisherId"] = self.grabId() # CREATE NEW BOOK WITH PUBLISHER addProcedures.addBook(self.store["title"], self.store["publisherId"])
def update_publisher(self): publishers = fetchProcedures.fetchPublishers() publishers = string_utils.build_input_options(self, publishers) self.choice = input("Which publisher would you like to update?\n" + publishers) self.store["pubId"] = self.grabId() self.store["name"] = input("What is the name of the publisher you wish to add?\n") self.store["address"] = input("What is the address of this publisher?") self.store["phone"] = input("What is the phone number of this publisher?") # UPDATE PUBLISHER (name, address, phone) updateProcedures.updatePublisherInfo(self.store["pubId"],self.store["name"],self.store["address"],self.store["phone"]) print("Updated publisher")
def update_book(self): books = fetchProcedures.fetchBooks() books = string_utils.build_input_options(self, books) self.choice = input("Which book do you want to update?\n" + books) self.store["bookId"] = self.grabId() self.store["new_title"] = input("What do you want the new title to be?\n") publishers = fetchProcedures.fetchPublishers() publishers = string_utils.build_input_options(self, publishers) self.choice = input("Who should the new publisher be?\n") self.store["new_pub_id"] = self.grabId() # UPDATE BOOK BY ID (bookId, new_title, new_pub_id) updateProcedures.updateBookInfo(self.store["bookId"], self.store["new_title"], self.store["new_pub_id"])