public async Task <RegisterOutput> Register(RegisterInput input) { bool isCaptchaValid = (ReCaptchaClass.Validate(input.CaptchaResponse) == "true" ? true : false); if (!isCaptchaValid) { throw new UserFriendlyException("تیک من ربات نیستم را کلیک نمایید."); } var userExists = userRepo.GetAll().Any(ff => ff.NormalizedEmailAddress == input.EmailAddress.ToUpper()); if (userExists) { throw new UserFriendlyException("آدرس ایمیل وارد شده تکراری است."); } var user = await _userRegistrationManager.RegisterAsync( input.Name, input.Surname, input.EmailAddress, input.EmailAddress, input.Password, input.KodeMelli, input.PhoneNumber, false ); user.SetNewEmailConfirmationCode(); BackgroundJobClient.Enqueue <AccountAppService>(instance => instance.SendConfirmEmailAsync(user)); var verifyCode = RandomService.GetNDigitsRandomNumber(4).ToString(); user.MobileVerificationCode = verifyCode; user.MobileVerificationCodeTime = DateTime.Now; user.IsPhoneNumberConfirmed = false; await UserManager.UpdateAsync(user); var message = $@"مالکینو کد تایید شما: {verifyCode} "; BackgroundJobClient.Enqueue <AccountAppService>(instance => instance.SendSms(message, user.PhoneNumber)); return(new RegisterOutput { RegisterResult = true }); }