def update_shipper_by_id(shipper_id): data = request.json c = bo.Shipper(ShipperID=shipper_id, ShipperName=data['ShipperName'], Phone=data['Phone']) result = do.Shipper(ConnectionData).update(c) return jsonify({'message': result[0]}), result[1]
def shipper_insert(): data = request.json c1 = bo.Shipper(ShipperName=data['ShipperName'], Phone=data['Phone']) c2 = do.Shipper(ConnectionData) s1 = c2.insert(c1) result = {} result['message'] = s1 return jsonify(result), 200
def delete_shipper_by_id(shipper_id): c = bo.Shipper(ShipperID=shipper_id) result = do.Shipper(ConnectionData).delete(c) return jsonify({'message': result[0]}), result[1]
def get_shipper_by_id(shipper_id): c = bo.Shipper(ShipperID=shipper_id) result = do.Shipper(ConnectionData).get_by_id(c) if result[1] != 200: return jsonify({'message': result[0]}), result[1] return jsonify(result[0].to_json()), 200
def get_all_shipper(): result = do.Shipper(ConnectionData).get_all() return jsonify(result), 200
def test_insert(): c2 = do.Shipper(ConnectionData) c1 = bo.Shipper(1, 'Tuan', 'TRAN') s1 = c2.insert(c1) return s1