Пример #1
0
        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();
        }
Пример #2
0
 public async Task<IActionResult> Delete([FromRoute][Required] RemoverAnuncioRequest request)
 {
     var removerAnuncioInput = new RemoverAnuncioInput(request.IdAnuncio);
     await _removerAnuncioUseCase.Execute(removerAnuncioInput);
     return _removerAnuncioPresenter.ViewModel;
 }