예제 #1
0
def get_one_order(id):
    order = OrdersEntity(OrderID=id)

    c = Orders(connection_data)

    result = c.get_one_Orders(order)

    return jsonify({'data': result})
예제 #2
0
파일: app.py 프로젝트: tunghqh/KTWEB
def add_orders():
    data = request.json
    orders = OrdersEntity(customer_id =data['customer_id'],
                                employee_id=data['employee_id'],
                                orderdate=data['orderdate'],
                                shipper_id=data['shipper_id']                            
                                )
    c = Orders(connection_data)
    message = c.insert(orders)
    if message is None:
        return jsonify({
            'message': 'Cannot insert data'
        }), 500
    return jsonify({
        'message': message
    })
예제 #3
0
def add_Orders():

    data = request.json

    order = OrdersEntity(CustomerID=data['CustomerID'],
                         EmployeeID=data['EmployeeID'],
                         OrderDate=data['OrderDate'],
                         ShipperID=data['ShipperID'])

    c = Orders(connection_data)

    message = c.insert_Orders(order)

    if message is None:

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

    return jsonify({'message': message})
예제 #4
0
def delete_Orders_by_id(id):

    if request.method == 'DELETE':

        # Delete user by id

        order = OrdersEntity(OrderID=id)

        c = Orders(connection_data)

        result = c.delete_Orders(order)

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

    else:
        # Update user by id

        data = request.json

        order = OrdersEntity(OrderID=id,
                             CustomerID=data['CustomerID'],
                             EmployeeID=data['EmployeeID'],
                             OrderDate=data['OrderDate'],
                             ShipperID=data['ShipperID'])

        c = Orders(connection_data)

        result = c.update_Orders(order)

        return jsonify({'message': result[0]}), result[1]
예제 #5
0
파일: app.py 프로젝트: tunghqh/KTWEB
def delete_orders_by_id(id):
    if request.method == 'DELETE':
        # Delete user by id
        orders = OrdersEntity(order_id=id)
        c = Orders(connection_data)
        result = c.delete(orders)
        return jsonify({
            'message': result[0]
        }), result[1]
    else:
        # Update user by id
        data = request.json
        orders= OrdersEntity(order_id=id,
                                customer_id =data['customer_id'],
                                employee_id=data['employee_id'],
                                orderdate=data['orderdate'],
                                shipper_id=data['shipper_id'] )
        c = Orders(connection_data)
        result = c.update(orders)
        return jsonify({
            'message': result[0]
        }), result[1]
예제 #6
0
파일: app.py 프로젝트: tunghqh/KTWEB
def get_all_orders():
    c = Orders(connection_data)
    result = c.get_all()
    return jsonify({
        'data': result
    })