本文整理汇总了C#中MediaBrowser.Controller.Entities.User.UpdateToRepository方法的典型用法代码示例。如果您正苦于以下问题:C# User.UpdateToRepository方法的具体用法?C# User.UpdateToRepository怎么用?C# User.UpdateToRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaBrowser.Controller.Entities.User
的用法示例。
在下文中一共展示了User.UpdateToRepository方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveConnect
private async Task RemoveConnect(User user, string connectUserId)
{
if (!string.IsNullOrWhiteSpace(connectUserId))
{
await CancelAuthorizationByConnectUserId(connectUserId).ConfigureAwait(false);
}
user.ConnectAccessKey = null;
user.ConnectUserName = null;
user.ConnectUserId = null;
user.ConnectLinkType = null;
await user.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
}
示例2: RemoveLink
private async Task RemoveLink(User user, string connectUserId)
{
if (!string.IsNullOrWhiteSpace(connectUserId))
{
var url = GetConnectUrl("ServerAuthorizations");
var options = new HttpRequestOptions
{
Url = url,
CancellationToken = CancellationToken.None
};
var postData = new Dictionary<string, string>
{
{"serverId", ConnectServerId},
{"userId", connectUserId}
};
options.SetPostData(postData);
SetServerAccessToken(options);
try
{
// No need to examine the response
using (var stream = (await _httpClient.SendAsync(options, "DELETE").ConfigureAwait(false)).Content)
{
}
}
catch (HttpException ex)
{
// If connect says the auth doesn't exist, we can handle that gracefully since this is a remove operation
if (!ex.StatusCode.HasValue || ex.StatusCode.Value != HttpStatusCode.NotFound)
{
throw;
}
_logger.Debug("Connect returned a 404 when removing a user auth link. Handling it.");
}
}
user.ConnectAccessKey = null;
user.ConnectUserName = null;
user.ConnectUserId = null;
user.ConnectLinkType = UserLinkType.LinkedUser;
await user.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
}