public async Task Categoria_Deletar() { var idAluno = 1; var aluno = new AlunoBuilderTest() .ComId(idAluno) .ComNomeAluno("Arthur") .ComEmail("*****@*****.**") .ComCpf("099.536.159-26") .ComTelefone("47991085945") .Construir(); _alunoRepository.GetById(idAluno).Returns(aluno); await _alunoService.Delete(idAluno); await _alunoRepository.Received(1).Delete(Arg.Any <AlunoEntity>()); }
public async Task <ActionResult> DeleteAluno(Guid id) { var aluno = await _repository.GetAlunoAssinatura(id); if (aluno == null) { return(NotFound()); } await _alunoService.Delete(aluno); return(CustomResponse()); }
public async Task <IActionResult> Delete(long id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { return(Ok(await _service.Delete(id))); } catch (ArgumentException e) { return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message)); } }
public async Task <IActionResult> Delete([FromRoute] int id) { try { await _alunoService.Delete(id); return(Ok("Aluno deletado com sucesso.")); } catch (AlunoException gex) { return(BadRequest(gex.Errors)); } catch (Exception ex) { return(StatusCode(500, ex.Message)); } }
public async Task <IActionResult> Delete([FromRoute] int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var aluno = await _alunoService.Get(id); if (aluno == null) { return(NotFound()); } _alunoService.Delete(aluno.IdAluno); _uow.Commit(); return(Ok(aluno)); }
public IActionResult Excluir(long cpf) { try { _service.Delete(cpf); return(Ok(new { success = true, data = "Registro excluído com sucesso!" })); } catch (Exception ex) { return(BadRequest(new { success = false, errors = ex.Message })); } }
public override void DeleteData() { AlunoDTO aluno = _control.GetAluno(); if (aluno == null) { MessageBox.Show("Nenhum aluno selecionado. Selecionar um aluno antes de solicitar a exclusão"); return; } if (MessageBox.Show("Deseja remover o aluno selecionado?", "", MessageBoxButtons.YesNoCancel) == DialogResult.Yes) { try { _alunoService.Delete(aluno.Id); _control.RefreshGrid(); } catch (Exception e) { MessageBox.Show(e.Message); } } }