예제 #1
0
        public UserDTO GetUserByEmailAndPass(string email, string password)
        {
            var pass = PasswordHashService.Hash(password);
            var res  = PasswordHashService.Check(pass, password);
            var user = _database.Users.GetUserByEmail(email);

            return(_mapper.Map <User, UserDTO>(user));
        }
예제 #2
0
        public UserDTO CreateUser(CreateUserDTO userDTO)
        {
            var pass = PasswordHashService.Hash(userDTO.Password);

            var user = userDTO.ToUpdateUser();

            user.Role     = "User";
            user.Password = pass;

            _database.Users.Add(user);
            _database.Save();

            return(_mapper.Map <User, UserDTO>(user));
            //return userDTO;
        }