本文整理汇总了C#中IUsersService.Edit方法的典型用法代码示例。如果您正苦于以下问题:C# IUsersService.Edit方法的具体用法?C# IUsersService.Edit怎么用?C# IUsersService.Edit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUsersService
的用法示例。
在下文中一共展示了IUsersService.Edit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpenIdFinishLogin
/// <summary>
/// Logs the user in or creates the user account if the user does not exist.
/// Sets the logged user in the session.
/// </summary>
public static int OpenIdFinishLogin(IAuthenticationResponse response, SessionWrapper session, IUsersService service, bool enableClaimsRequest)
{
string externalId = response.ClaimedIdentifier.ToString();
User user = service.GetByProviderId(AuthenticationProvider.OpenId, externalId);
var claimsResponse = response.GetExtension<ClaimsResponse>();
string name = enableClaimsRequest ? claimsResponse.Nickname : response.FriendlyIdentifierForDisplay;
if (user == null)
{
user = new User(0, name);
if (enableClaimsRequest)
{
user.Email = claimsResponse.Email;
user.BirthDate = claimsResponse.BirthDate;
}
user = service.Add(user, AuthenticationProvider.OpenId, externalId);
}
else
{
if (enableClaimsRequest && !claimsResponse.Email.Equals(user.Email, StringComparison.CurrentCultureIgnoreCase))
{
user.Email = claimsResponse.Email;
service.Edit(user);
}
}
session.SetUser(user, AuthenticationProvider.OpenId);
return user.Id;
}