Пример #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
Пример #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]
Пример #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]
Пример #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
Пример #5
0
def get_all_order():
    c = do.Order(ConnectionData).get_all()
    return jsonify(c), 200