Exemplo n.º 1
0
def createClinic(name, address):
    response = False
    if (clinicExistsByData(name, address)):
        response = False
    else:
        ClinicTDG.create(name, address)
        response = True
    return response
Exemplo n.º 2
0
def deleteClinic(id):
    response = False
    if (getClinicById(id) is None):
        response = False
    else:
        ClinicTDG.delete(id)
        response = True
    return response
Exemplo n.º 3
0
def updateClinic(id, name, address):
    ClinicTDG.update(id, name, address)
    updatedClinic = ClinicTDG.find(id)
    if ((updatedClinic.name == name) & (updatedClinic.address == address)):
        return True
    return False
Exemplo n.º 4
0
def getClinicById(id):
    clinic = ClinicTDG.find(id)
    if clinic is not None:
        return dict(clinic)
    else:
        return None
Exemplo n.º 5
0
def clinicExistsByData(name, address):
    clinic = ClinicTDG.findByData(name, address)
    if clinic is not None:
        return True
    return False
Exemplo n.º 6
0
def clinicExistsById(id):
    clinic = ClinicTDG.find(id)
    if clinic is not None:
        return True
    return False
Exemplo n.º 7
0
def getAllClinics():
    listOfClinics = []
    clinics = ClinicTDG.findAll()
    for clinic in clinics:
        listOfClinics.append(dict(clinic))
    return listOfClinics
Exemplo n.º 8
0
def getClinicByData(name, address):
    clinic = ClinicTDG.findByData(name, address)
    if clinic is not None:
        return dict(clinic)
    return False