コード例 #1
0
def get_all_Shippers():

    c = Shippers(connection_data)

    result = c.get_all_Shippers()

    return jsonify({'data': result})
コード例 #2
0
def get_one_shipper(id):
    shipper = ShippersEntity(ShipperID=id)

    c = Shippers(connection_data)

    result = c.get_one_Shippers(shipper)

    return jsonify({'data': result})
コード例 #3
0
ファイル: app.py プロジェクト: tunghqh/KTWEB
def add_shippers():
    data = request.json
    shippers = ShippersEntity(shipper_name=data['shipper_name'],
                                phone=data['phone']
                                )
    c = Shippers(connection_data)
    message = c.insert(shippers)
    if message is None:
        return jsonify({
            'message': 'Cannot insert data'
        }), 500
    return jsonify({
        'message': message
    })
コード例 #4
0
def add_Shippers():

    data = request.json

    ship = ShippersEntity(ShipperName=data['ShipperName'], Phone=data['Phone'])

    c = Shippers(connection_data)

    message = c.insert_Shippers(ship)

    if message is None:

        return jsonify({'message': 'Cannot insert data'}), 500

    return jsonify({'message': message})
コード例 #5
0
def delete_Shippers_by_id(id):

    if request.method == 'DELETE':

        # Delete user by id

        shipp = ShippersEntity(ShipperID=id)

        c = Shippers(connection_data)

        result = c.delete_Shippers(shipp)

        return jsonify({'message': result[0]}), result[1]

    else:
        # Update user by id

        data = request.json

        shipp = ShippersEntity(ShipperID=id,
                               ShipperName=data['ShipperName'],
                               Phone=data['Phone'])

        c = Shippers(connection_data)

        result = c.update_Shippers(shipp)

        return jsonify({'message': result[0]}), result[1]
コード例 #6
0
ファイル: app.py プロジェクト: tunghqh/KTWEB
def delete_shippers_by_id(id):
    if request.method == 'DELETE':
        # Delete user by id
        shippers = ShippersEntity(shipper_id=id)
        c = Shippers(connection_data)
        result = c.delete(shippers)
        return jsonify({
            'message': result[0]
        }), result[1]
    else:
          # Update user by id
        data = request.json
        shippers = ShippersEntity(shipper_id=id,
                                    shipper_name=data['shipper_name'],
                                phone=data['phone'])
        c = Shippers(connection_data)
        result = c.update(shippers)
        return jsonify({
            'message': result[0]
        }), result[1]