示例#1
0
        public async Task <IActionResult> Post([FromBody] UserSignUpInfo user)
        {
            try
            {
                user.Password = this._hasher.HashPassword(user.Password);

                var userId = (int)await this._dm.OperateAsync <UserSignUpInfo, object>(
                    Constants.CreateUser, user);

                if (userId == 0)
                {
                    this._logger.Log(LogHelper.CreateLog(
                                         DateTime.Now, LogType.Fail, Constants.UserSignUpFail, null));

                    return(this.BadRequest(Constants.UserSignUpFail));
                }

                await this._mailer.SendAsync(
                    user.Email, Constants.WelcomeSubject, false, Constants.WelcomeMessage);

                return(this.Ok(Constants.UserCreationSuccess));
            }
            catch (Exception ex)
            {
                this._logger.Log(LogHelper.CreateLog(
                                     DateTime.Now, LogType.Fatal, Constants.UserCreationError, ex));

                return(new StatusCodeResult(StatusCodes.Status500InternalServerError));
            }
        }
        public void CreateUser(UserSignUpInfo userSignUpInfo)
        {
            var key = Key.From <UserCredentials>(userSignUpInfo.Credentials.UserName);

            state.Add(key, userSignUpInfo.Credentials);

            key = Key.From <UserSignUpInfo>(userSignUpInfo.Credentials.UserName);
            state.Add(key, userSignUpInfo);
        }
示例#3
0
        public void CreateUser(UserSignUpInfo signUpInfo)
        {
            MembershipCreateStatus status;
            var user = provider.CreateUser(
                signUpInfo.Credentials.UserName,
                signUpInfo.Credentials.Password,
                signUpInfo.Info.Email,
                signUpInfo.Question.DisplayName,
                signUpInfo.Answer, true, null, out status);

            if (status != MembershipCreateStatus.Success)
            {
                throw new RepositoryFailureException(MembershipCreateStatusHelper.ErrorCodeToString(status));
            }

            var staff = new Entities.Staff()
            {
                DisplayName = signUpInfo.Info.DisplayName,
                UserId      = (Guid)user.ProviderUserKey,
                StaffType   = 'T'
            };

            context.Staffs.InsertOnSubmit(staff);
        }
示例#4
0
 public void CreateUser(UserSignUpInfo userSignUpInfo)
 {
     innerRepository.CreateUser(userSignUpInfo);
 }
示例#5
0
 public async Task <Response <string> > SignUpUserAsync(UserSignUpInfo userSignUpInfo)
 {
     return(await this.SendPostRequest(SIGN_UP_URI, userSignUpInfo));
 }
 public virtual bool CreateUser(UserSignUpInfo signUpInfo)
 {
     return(inner.CreateUser(signUpInfo));
 }
 public bool CreateUser(UserSignUpInfo signUpInfo)
 {
     return(WithValid(signUpInfo, () => membershipRepository.CreateUser(signUpInfo)));
 }