public void CreateOrUpdateAccount(string providerName, string providerUserId, IUser user, IDictionary <string, string> providerUserData = null) { if (user == null) { throw new MembershipCreateUserException(MembershipCreateStatus.ProviderError); } var record = _userProviderServices.Get(providerName, providerUserId); var providerData = providerUserData == null ? null : providerUserData.ToJson(); var eventContext = new CreatedOpenAuthUserContext(user, providerName, providerUserId, providerUserData); if (record == null) { _userProviderServices.Create(providerName, providerUserId, user, providerData); _openAuthUserEventHandler.ProviderRecordCreated(eventContext); } else { _userProviderServices.Update(providerName, providerUserId, user, providerData); } _openAuthUserEventHandler.ProviderRecordUpdated(eventContext); }
public void CreateOrUpdateAccount(string providerName, string providerUserId, IUser user) { if (user == null) { throw new MembershipCreateUserException(MembershipCreateStatus.ProviderError); } var record = _userProviderServices.Get(providerName, providerUserId); if (record == null) { _userProviderServices.Create(providerName, providerUserId, user); } else { _userProviderServices.Update(providerName, providerUserId, user); } }