示例#1
0
        private async void AddUserAsync()
        {
            if (!string.IsNullOrEmpty(LastName) && !string.IsNullOrEmpty(FirstName) && !string.IsNullOrEmpty(Province) && !string.IsNullOrEmpty(Email) && !string.IsNullOrEmpty(PhoneNumber))
            {
                var user = await ApplicationUserRepository.CreateAsync(
                    new Usermodel
                {
                    Fullname        = $"{FirstName} {LastName}",
                    Email           = Email,
                    PhoneNumber     = PhoneNumber,
                    ConfirmPassword = "******",
                    Password        = "******",
                    Province        = Province,
                    FullAddress     = FullAddress,
                    Role            = "Doctor"
                });

                if (user.identityResult.Succeeded)
                {
                    FirstName   = string.Empty;
                    Email       = string.Empty;
                    PhoneNumber = string.Empty;
                    FullAddress = string.Empty;
                    LastName    = string.Empty;
                    Province    = string.Empty;
                    StateHasChanged();
                    await SweetAlertMessage.SuccessMessage();
                }
            }
        }
 public async Task <IdentityResult> CreateUserAsync(ApplicationUser user, string cleanPassword)
 {
     return(await _applicationUserRepository.CreateAsync(user, new object[] { cleanPassword }));
 }