Exemplo n.º 1
0
        public bool IsValidInsert(INotification _notification)
        {
            if (!Email.IsValidEMail())
            {
                return(_notification.AddWithReturn <bool>("O E-mail informado não é válido!"));
            }

            if (string.IsNullOrEmpty(Name))
            {
                return(_notification.AddWithReturn <bool>("O Nome informado não é válido!"));
            }

            if (string.IsNullOrEmpty(PasswordHash))
            {
                return(_notification.AddWithReturn <bool>("A Senha informada não é válido!"));
            }

            if (string.IsNullOrEmpty(Gender))
            {
                return(_notification.AddWithReturn <bool>("O Gênero informado não é válido!"));
            }

            if (Birth == null)
            {
                return(_notification.AddWithReturn <bool>("A Data de nasciment informada não é válido!"));
            }

            return(true);
        }
Exemplo n.º 2
0
        public UserDto GetByEmailAndPassword(string email, string password)
        {
            var user = _userRepository.GetByEmailAndPassword(email, Encryption.Encrypt(password.ToLower()));

            if (user == null)
            {
                return(_notification.AddWithReturn <UserDto>("O E-mail ou a Senha estão incorretos!"));
            }

            return(new UserDto
            {
                Email = user.Email,
                Name = user.Name,
                Gender = user.Gender,
                Birth = user.Birth
            });
        }