Exemple #1
0
        public async Task DeleteGame(Guid idJogo)
        {
            var jogo = await _jogoRepository.GetById(idJogo);

            if (jogo == null)
            {
                throw new JogoNaoCadastradoException();
            }

            await _jogoRepository.Delete(idJogo);
        }
Exemple #2
0
        public IActionResult Delete(int id)
        {
            JogoDomain jogoBuscado = _jogorepository.GetporId(id);

            if (jogoBuscado != null)
            {
                _jogorepository.Delete(id);

                return(Ok($"O Jogo {id} foi deletado com sucesso!"));
            }

            return(NotFound("Nenhum Jogo encontrado"));
        }
        public bool Delete(Guid id)
        {
            Jogo _jogo = _repository.GetById(id);

            if (_jogo == null)
            {
                throw new ApiException(ApiErrorCodes.INVJOGO);
            }

            _repository.Delete(_jogo);

            if (!_uow.Commit())
            {
                throw new ApiException(ApiErrorCodes.ERROPBD);
            }

            return(true);
        }