예제 #1
0
        public NotificationResult Excluir(Jogador entidade)
        {
            var NotificationResult = new NotificationResult();

            try
            {
                if (entidade.CodJogador != 0)
                {
                    if (NotificationResult.IsValid)
                    {
                        _jogadorRepositorio.Remover(entidade);
                        NotificationResult.Add("Cadastro excluido com Sucesso!");

                        return(NotificationResult);
                    }

                    else
                    {
                        return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER)));
                    }
                }

                else
                {
                    return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER)));
                }
            }

            catch (Exception ex)
            {
                return(NotificationResult.Add(new NotificationError(ex.Message)));
            }
        }
예제 #2
0
 public IActionResult Deletar([FromBody] Jogador jogador)
 {
     try
     {
         _jogadorRepositorio.Remover(jogador);
         return(Json(_jogadorRepositorio.ObterTodos()));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.ToString()));
     }
 }