Exemple #1
0
        public bool AreCredentialsValid(UserDto userDto)
        {
            var encryptedPassword = CryptographyUtils.EncryptPassword(userDto.Password);

            return((from u in _dbContext.User
                    where string.Equals(u.Email, userDto.Email, StringComparison.CurrentCultureIgnoreCase) &&
                    u.EncryptedPassword == encryptedPassword
                    select true).FirstOrDefault());
        }
Exemple #2
0
        public void Register(UserDto userDto)
        {
            var user = new User
            {
                Email             = userDto.Email,
                EncryptedPassword = CryptographyUtils.EncryptPassword(userDto.Password),
            };

            _dbContext.User.Add(user);
            _dbContext.SaveChanges();
        }