Example #1
0
def delete(id):
    """ Apaga aluno com id informado"""
    try:
        repositorio_alunos.delete(get_datastore_session(), repositorio_alunos.get(get_datastore_session(), id))
        return "Elemento Apagado"
    except ValueError:
        return None
Example #2
0
def update(id):
    """ Atualiza aluno com id informado"""
    application = repositorio_alunos.update(get_datastore_session(), repositorio_alunos.get(get_datastore_session(), id), **request.json)
    return json.dumps(application, cls=JSONEncoder)
Example #3
0
def get_id(id):
    """ Busca um aluno com id informado"""
    application = repositorio_alunos.get(get_datastore_session(), id)
    return json.dumps(application, cls=JSONEncoder)
Example #4
0
def create():
    """ Cria novo aluno com os parametros informado"""
    if not request.json:
        abort(400)

    return json.dumps(repositorio_alunos.create(get_datastore_session(), **request.json), cls=JSONEncoder)
Example #5
0
def get():
    """ Lista todos os alunos"""
    return json.dumps(repositorio_alunos.all(get_datastore_session()), cls=JSONEncoder)