public void Create(User user, string password) { if (user == null) { throw new ArgumentNullException(nameof(user), "must not be null."); } if (string.IsNullOrEmpty(password)) { throw new ArgumentNullException(nameof(password), "must not be null."); } if (user.IsUsedEmail()) { throw new BusinessRuleException(nameof(user), BusinessRules.UsedEmail); } // https://stackoverflow.com/questions/45725544/usermanager-createasync-success-always-returns-false Task <IdentityResult> result = CreateAsync(user, password); //Burada kullanıcı rolü rol tablosuna farklı bir id ile tekrar ekleniyor!!! if (result.Result.Succeeded) { var userResult = _identityUserRepository.FindByNameAsync(user.UserName); } else { var errors = result.Result.Errors; var message = string.Join(", ", errors); } }
public User Create(User user, string password) { ValidateUserWithPassword(user, password); IdentityResult identity = TaskUtil.Await(() => CreateAsync(user, password)); if (!identity.Succeeded) { throw new BusinessRuleException(nameof(User), ""); } return(TaskUtil.Await(() => identityUserRepository.FindByNameAsync(user.UserName))); }