public User InsertNewUser(User user)
        {
            if (IsDuplicateUser(user))
            {
                return(null);
            }

            user.Password = HashingSHA.GenerateSHA256String(user.Password);
            return(_userRepository.AddUser(user));
        }
Esempio n. 2
0
        public async Task <User> InsertNewUser(User user)
        {
            if (await _userRepository.IsDuplicateUser(user))
            {
                return(null);
            }

            user.Password = HashingSHA.GenerateSHA256String(user.Password);
            return(await _userRepository.AddUser(user));
        }
        public async Task <UserDto> InsertNewUser(UserDto user)
        {
            var result = await _userRepository.AddUser(new User
            {
                FirstName = user.FirstName,
                LastName  = user.LastName,
                Email     = user.Email,
                Role      = await _roleRepository.GetRole(user.Type.ToString()),
                Password  = HashingSHA.GenerateSHA256String(user.Password)
            });

            return(result.ToUserDto());
        }
 public async Task <Boolean> VerifyPassword(UserDto user, String password)
 {
     return(await _userRepository.CheckUserPassword(user.Email, HashingSHA.GenerateSHA256String(password)));
 }
 public User GetValidUser(User user)
 {
     user.Password = HashingSHA.GenerateSHA256String(user.Password);
     return(_userRepository.GetValidUser(user));
 }
Esempio n. 6
0
 public async Task <User> GetValidUser(User user)
 {
     user.Password = HashingSHA.GenerateSHA256String(user.Password);
     return(await _userRepository.GetValidUser(user));
 }