public async Task Execute(RemoverAnuncioInput removerAnuncioInput) { if (removerAnuncioInput.Id == 0) { _outputHandler.NotFound($"Codigo do anuncio inválido."); return; } var anuncio = await _anuncioRepository.Get(removerAnuncioInput.Id); if (anuncio == null) { _outputHandler.NotFound($"Anuncio não encontrado."); return; } await _anuncioRepository.Delete(anuncio); _outputHandler.Default(); }
public async Task<IActionResult> Delete([FromRoute][Required] RemoverAnuncioRequest request) { var removerAnuncioInput = new RemoverAnuncioInput(request.IdAnuncio); await _removerAnuncioUseCase.Execute(removerAnuncioInput); return _removerAnuncioPresenter.ViewModel; }