def update_customer(self, customer): customerId = Input.input_id(self.model.tableName) customer = Input.input_update_customer(customer) older = self.model.read_customer(customerId) newCustomer = Check.updateCustomer(customer, older) check = self.model.update_customer(customerId, newCustomer['name'], newCustomer['phone'], newCustomer['sex']) if check: self.view.display_customer_updated(customerId, newCustomer['name'], newCustomer['phone'], newCustomer['sex'])
def insert_customer(self, customer): try: customer = Input.input_update_customer(customer) assert Check.isExistAllOptionCustomer(customer), \ '\033[91m you don\'t add all needed customer\'s option \033[0m ' check = self.model.create_customer(customer['name'], customer['phone'], customer['sex']) if check: self.view.display_stored(customer['name'], self.model.tableName) except Exception as err: print(err)