update people sort orders
This commit is contained in:
parent
e9d4b8211c
commit
215776dce6
|
@ -679,19 +679,35 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
public object Post(MarkPlayedItem request)
|
public object Post(MarkPlayedItem request)
|
||||||
|
{
|
||||||
|
var result = MarkPlayed(request).Result;
|
||||||
|
|
||||||
|
return ToOptimizedResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<UserItemDataDto> MarkPlayed(MarkPlayedItem request)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(request.UserId);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
DateTime? datePlayed = null;
|
DateTime? datePlayed = null;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(request.DatePlayed))
|
if (!string.IsNullOrEmpty(request.DatePlayed))
|
||||||
{
|
{
|
||||||
datePlayed = DateTime.ParseExact(request.DatePlayed, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
|
datePlayed = DateTime.ParseExact(request.DatePlayed, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
|
||||||
}
|
}
|
||||||
|
|
||||||
var task = UpdatePlayedStatus(user, request.Id, true, datePlayed);
|
var session = GetSession();
|
||||||
|
|
||||||
return ToOptimizedResult(task.Result);
|
var dto = await UpdatePlayedStatus(user, request.Id, true, datePlayed).ConfigureAwait(false);
|
||||||
|
|
||||||
|
foreach (var additionalUserInfo in session.AdditionalUsers)
|
||||||
|
{
|
||||||
|
var additionalUser = _userManager.GetUserById(new Guid(additionalUserInfo.UserId));
|
||||||
|
|
||||||
|
await UpdatePlayedStatus(additionalUser, request.Id, true, datePlayed).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SessionInfo GetSession()
|
private SessionInfo GetSession()
|
||||||
|
@ -780,13 +796,29 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
public object Delete(MarkUnplayedItem request)
|
public object Delete(MarkUnplayedItem request)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(request.UserId);
|
var task = MarkUnplayed(request);
|
||||||
|
|
||||||
var task = UpdatePlayedStatus(user, request.Id, false, null);
|
|
||||||
|
|
||||||
return ToOptimizedResult(task.Result);
|
return ToOptimizedResult(task.Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<UserItemDataDto> MarkUnplayed(MarkUnplayedItem request)
|
||||||
|
{
|
||||||
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
|
var session = GetSession();
|
||||||
|
|
||||||
|
var dto = await UpdatePlayedStatus(user, request.Id, false, null).ConfigureAwait(false);
|
||||||
|
|
||||||
|
foreach (var additionalUserInfo in session.AdditionalUsers)
|
||||||
|
{
|
||||||
|
var additionalUser = _userManager.GetUserById(new Guid(additionalUserInfo.UserId));
|
||||||
|
|
||||||
|
await UpdatePlayedStatus(additionalUser, request.Id, false, null).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the played status.
|
/// Updates the played status.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user