Example #1
0
def update_shipper_by_id(shipper_id):
    data = request.json
    c = bo.Shipper(ShipperID=shipper_id,
                   ShipperName=data['ShipperName'],
                   Phone=data['Phone'])
    result = do.Shipper(ConnectionData).update(c)
    return jsonify({'message': result[0]}), result[1]
Example #2
0
def shipper_insert():
    data = request.json
    c1 = bo.Shipper(ShipperName=data['ShipperName'], Phone=data['Phone'])
    c2 = do.Shipper(ConnectionData)
    s1 = c2.insert(c1)
    result = {}
    result['message'] = s1
    return jsonify(result), 200
Example #3
0
def delete_shipper_by_id(shipper_id):
    c = bo.Shipper(ShipperID=shipper_id)
    result = do.Shipper(ConnectionData).delete(c)
    return jsonify({'message': result[0]}), result[1]
Example #4
0
def get_shipper_by_id(shipper_id):
    c = bo.Shipper(ShipperID=shipper_id)
    result = do.Shipper(ConnectionData).get_by_id(c)
    if result[1] != 200:
        return jsonify({'message': result[0]}), result[1]
    return jsonify(result[0].to_json()), 200
Example #5
0
def get_all_shipper():
    result = do.Shipper(ConnectionData).get_all()
    return jsonify(result), 200
Example #6
0
File: app.py Project: tuan19989/CNW
def test_insert():
    c2 = do.Shipper(ConnectionData)
    c1 = bo.Shipper(1, 'Tuan', 'TRAN')
    s1 = c2.insert(c1)
    return s1