예제 #1
0
def listproductsRecomended():
    results = []
    error = False
    prod = Product()
    prod.type = request.json['type']
    prod.id = request.json['id']
    try:
        results = prod.listRecomended()
    except (Exception) as err:
        error = True
        return handleError(err)
    finally:
        if not (error):
            return jsonify({'result': 'success', 'data': results})
예제 #2
0
def modProduct():
    error = False
    prod = Product()
    prod.id = request.json['id']
    prod.name = request.json['name']
    prod.dsc = request.json['dsc']
    prod.material = request.json['material']
    prod.genre = request.json['genre']
    prod.brand = request.json['brand']
    prod.type = request.json['type']
    prod.discount = request.json['discount']
    prod.price = request.json['price']
    try:
        prod.mod()
    except (Exception) as err:
        error = True
        return handleError(err)
    finally:
        if not (error):
            return jsonify({'result': 'success'})