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
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)
def get_id(id): """ Busca um aluno com id informado""" application = repositorio_alunos.get(get_datastore_session(), id) return json.dumps(application, cls=JSONEncoder)
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)
def get(): """ Lista todos os alunos""" return json.dumps(repositorio_alunos.all(get_datastore_session()), cls=JSONEncoder)