public IActionResult Excluir([FromBody] int id) { try { _alunoRepository.Excluir(id); return(Ok(new { msg = "Excluído com sucesso." })); } catch (Exception) { return(new StatusCodeResult(412)); // Pré-condição falhou, pois provavelmente esse registro há relacionamentos que o impedem de ser excluído. } }
public IActionResult Delete(int id) { try { _repo.Excluir(id); return(Ok(_repo.SelecionarTudo())); } catch (System.Exception) { return(StatusCode(500)); } }
public void Excluir(int id) { var alunoExistente = repository.ObterPorId(id); if (alunoExistente != null) { repository.Excluir(id); } else { AddNotification("aluno", "Não é possivel excluir um aluno que não existe."); } }
public IActionResult Delete(int id) { try { _repoAluno.Excluir(id); List <Aluno> alunos = _repoAluno.SelecionarTudo(); return(Ok(_mapper.Map <IEnumerable <AlunoDto> >(alunos))); } catch (System.Exception) { return(StatusCode(500)); } }
public string Excluir(int idAluno) { try { Aluno aluno = ObterPorId(idAluno); AlunoRepository.Excluir(aluno); //Executa as ações AlunoRepository.SalvarAlteracoes(); return(null); } catch (Exception ex) { return("Erro: " + ex.Message); } }
public void Excluir(int id) { _AlunoRepository.Excluir(id); }
public IEnumerable <Aluno> Delete(int id) { _repo.Excluir(id); return(_repo.SelecionarTudo()); }
public void Delete(int id) { _repo.Excluir(id); }