예제 #1
0
파일: UserRepo.cs 프로젝트: zcurry-Dev/SS
        public async Task <IdentityResult> RegisterUserAsync(UserForRegisterDto userForRegisterDto)
        {
            var user = _map.MapToSsuser(userForRegisterDto);

            user.UserStatusId = 1;
            var result = await _user.CreateUserAsync(user, userForRegisterDto.Password);

            if (!result.Succeeded)
            {
                return(result);
            }
            result = await _user.AddUserRoleOnRegisterAsync(user);

            return(result);
        }
예제 #2
0
        public async Task <UserIdentityResult> CreateAsync(UserModel userModel, string password)
        {
            try
            {
                var userId = await _userData.CreateUserAsync(userModel, password);

                return(new UserIdentityResult
                {
                    Id = userId,
                    Succeeded = true,
                    Errors = null
                });
            }
            catch (Exception e)
            {
                return(new UserIdentityResult
                {
                    Id = 0,
                    Succeeded = false,
                    Errors = new [] { e.Message }
                });
            }
        }