예제 #1
0
def user_insert():
    data = request.json
    c1 = bo.Customer(1, data['CustomerName'], data['ContactName'],
                     data['Address'], data['City'], data['PostalCode'],
                     data['Country'])
    c2 = do.Customer(ConnectionData)
    s1 = c2.insert(c1)
    result = {}
    result['message'] = s1
    return jsonify(result), 200
예제 #2
0
def update_user_by_id(customer_id):
    data = request.json
    c = bo.Customer(CustomerID=customer_id,
                    CustomerName=data['CustomerName'],
                    ContactName=data['ContactName'],
                    Address=data['Address'],
                    City=data['City'],
                    PostalCode=data['PostalCode'],
                    Country=data['Country'])
    result = do.Customer(ConnectionData).update(c)
    return jsonify({'message': result[0]}), result[1]
예제 #3
0
def delete_user_by_id(customer_id):
    c = bo.Customer(CustomerID=customer_id)
    result = do.Customer(ConnectionData).delete(c)
    return jsonify({'message': result[0]}), result[1]
예제 #4
0
def get_user_by_id(customer_id):
    c = bo.Customer(CustomerID=customer_id)
    result = do.Customer(ConnectionData).get_by_id(c)
    if result[1] != 200:
        return jsonify({'message': result[0]}), result[1]
    return jsonify(result[0].to_json()), 200
예제 #5
0
def get_all_user():
    result = do.Customer(ConnectionData).get_all()
    return jsonify(result), 200
예제 #6
0
파일: app.py 프로젝트: Letien191299/Web
def test_insert():
    c2 = do.Customer(ConnectionData)
    c1 = bo.Customer('Tien', 'Do', '1999', 'QuangBinh', 'DongHoi', 'VietNam')
    s1 = c2.insert(c1)
    return s1