Exemplo n.º 1
0
def insert_order():
    data = request.json
    order = bo.Order(CustomerID=data['CustomerID'],
                     EmployeeID=data['EmployeeID'],
                     OrderDate=data['OrderDate'],
                     ShipperID=data['ShipperID'])
    result = do.Order(ConnectionData).insert(order)
    return jsonify({'message': result}), 200
Exemplo n.º 2
0
def update_order_by_id(od_id):
    data = request.json
    order = bo.Order(OrderID=od_id,
                     CustomerID=data['CustomerID'],
                     EmployeeID=data['EmployeeID'],
                     OrderDate=data['OrderDate'],
                     ShipperID=data['ShipperID'])
    result = do.Order(ConnectionData).update(order)
    return jsonify({'message': result[0]}), result[1]
Exemplo n.º 3
0
def delete_order_by_id(od_id):
    c = bo.Order(OrderID=od_id)
    result = do.Order(ConnectionData).delete(c)
    return jsonify({'message': result[0]}), result[1]
Exemplo n.º 4
0
def get_order_by_id(od_id):
    order = bo.Order(OrderID=od_id)
    result = do.Order(ConnectionData).get_by_id(order)
    if result[1] != 200:
        return jsonify({'message': result[0]}), result[1]
    return jsonify(result[0].to_json()), 200
Exemplo n.º 5
0
def get_all_order():
    c = do.Order(ConnectionData).get_all()
    return jsonify(c), 200