def update(employee_ID):
    foundPerson = employeeDAO.findById(employee_ID)
    print(foundPerson)
    if foundPerson == {}:
        return jsonify({}), 404
    currentPerson = foundPerson
    if 'employee_Name' in request.json:
        currentPerson['employee_Name'] = request.json['employee_Name']
    if 'employee_Dept_ID' in request.json:
        currentPerson['employee_Dept_ID'] = request.json['employee_Dept_ID']
    if 'employee_Salary' in request.json:
        currentPerson['employee_Salary'] = request.json['employee_Salary']
    employeeDAO.update(currentPerson)
    return jsonify(currentPerson)
Beispiel #2
0
def update(id):
    foundEmployee = employeeDAO.findById(id)
    print(foundEmployee)
    if foundEmployee == {}:
        return jsonify({}), 404
    currentEmployee = foundEmployee
    if 'f_name' in request.json:
        currentEmployee['f_name'] = request.json['f_name']
    if 's_name' in request.json:
        currentEmployee['s_name'] = request.json['s_name']
    if 'age' in request.json:
        currentEmployee['age'] = request.json['age']
    if 'emp_role' in request.json:
        currentEmployee['emp_role'] = request.json['emp_role']
    if 'salary' in request.json:
        currentEmployee['salary'] = request.json['salary']

    employeeDAO.update(currentEmployee)
    return jsonify(currentEmployee)
def findById(employee_ID):
    return jsonify(employeeDAO.findById(employee_ID))
Beispiel #4
0
def findById(id):
    foundEmployee = employeeDAO.findById(id)
    return jsonify(foundEmployee)
Beispiel #5
0
    'employee_Dept_ID': 123,
    'employee_Salary': 350.00
}

person2 = {
    'employee_ID': 124,
    'employee_Name': 'Mary',
    'employee_Dept_ID': 123,
    'employee_Salary': 370.00
}
# returnValue = employeeDAO.create(person)  # works
# returnValue = employeeDAO.create(person2)
# print (returnValue)

# print("Find By ID")
returnValue = employeeDAO.findById('employee_ID')
print(returnValue)

# returnValue =  employeeDAO.findById(person2['employee_ID'])
# print (returnValue)

# returnValue =  employeeDAO.update(person2)
# print (returnValue)

# returnValue =  employeeDAO.findById(person2['employee_ID'])
# print (returnValue)

# returnValue =  employeeDAO.delete(person2['employee_ID'])
# print (returnValue)

returnValue = employeeDAO.getAll()