def insert_shop(self, shop): try: shop = Input.input_update_shop(shop) assert Check.isExistAllOptionShop( shop ), '\033[91m you don\'t add all needed shop\'s option \033[0m' self.model.create_shop(shop['name'], shop['street']) self.view.display_stored(shop['name'], self.model.tableName) except Exception as err: print(err)
def update_shop(self, shop): shopId = Input.input_id(self.model.tableName) shop = Input.input_update_shop(shop) older = self.model.read_shop(shopId) newShop = Check.updateShop(shop, older) check = self.model.update_shop(shopId, newShop['name'], newShop['street']) if check: self.view.display_shop_updated(shopId, older[0][1], older[0][2], newShop['name'], newShop['street'])
def update_shop(self, shop): shopId = Input.input_id(self.model.tableName) shop = Input.input_update_shop(shop) older = self.model.read_shop(shopId) newShop = Check.updateShop( shop, [older[0].ShopId, older[0].ShopName, older[0].ShopStreet]) check = self.model.update_shop(shopId, newShop['name'], newShop['street']) if check: print(older[0].ShopName, older[0].ShopStreet) self.view.display_shop_updated(shopId, newShop['name'], newShop['street'])