示例#1
0
        public AutenticarJogadorResponse Autenticar(AutenticarJogadorRequest request)
        {
            if (request == null)
            {
                AddNotification("AutenticarJogadorRequest", string.Format(Message.X0_Obrigatorio, "AutenticarJogadorRequest"));
            }

            //if (string.IsNullOrEmpty(request.Email.Endereco))
            //    throw new Exception("Informe um E-mail");

            //if (string.IsNullOrEmpty(request.Senha))
            //    throw new Exception("Informe uma Senha");

            //if (request.Senha.Length < 6)
            //    throw new Exception("A Senha deve ter no mínimo 6 caracteres");

            var jogador = new Jogador(new Email(request.Email.Endereco), request.Senha);

            AddNotifications(jogador.Notifications);

            if (jogador.IsInvalid())
            {
                return(null);
            }

            var response = _repositoryJogador.Autenticar(request);

            return(response);
        }