Beispiel #1
0
def update_employees():
    cn_db = db_emp.employees(con_db)
    data = request.json
    emp1 = emp.employees(data['employee_id'], data['last_name'],
                         data['first_name'], data['title'],
                         data['title_of_courtesy'], data['birth_date'],
                         data['hire_date'], data['address'], data['city'],
                         data['region'], data['postal_code'], data['country'],
                         data['home_phone'], data['extension'], data['photo'],
                         data['notes'], data['photo_path'])
    rs = cn_db.update(emp1)
    return jsonify({'message': rs}), 200
Beispiel #2
0
def one_employees(employee_id):
    e = emp.employees(employee_id=employee_id)
    rs = db_emp.employees(con_db).get_by_id(e)
    if rs[1] != 200:
        return jsonify({'message': rs[0]}), rs[1]
    return jsonify({'message': rs[0].to_json()}), 200
Beispiel #3
0
def delete_employees(employee_id):
    cn_db = db_emp.employees(con_db)
    rs = cn_db.delete(employee_id)
    return jsonify({'message': rs}), 200
Beispiel #4
0
def all_employees():
    result = db_emp.employees(con_db).get_all()
    return jsonify({'data': result}), 200