Example #1
0
 def put(self, name):
     data = self.parser.parse_args()
     item = ItemModel.find_by_name(name)
     if item is None:
         item = ItemModel(**data)
     else:
         item.price = data["price"]
     item.save_to_db()
     return item.json, 200
Example #2
0
    def put(self, name):
        requested_data = Item.parser.parse_args()
        item = ItemModel.find_by_name(name)

        if item is None:
            item = ItemModel(name, **requested_data)
        else:
            item.price = requested_data["price"]

        item.save_to_db()

        return item.json()
Example #3
0
    def put(self, name):

        data = Item.parser.parse_args()

        item = ItemModel.find_by_name(name)

        if item is None:
            item = ItemModel(name, data['price'], data["store_id"])
        else:
            item.price = data['price']

        item.save_to_db()
        return item.json()