/// <summary> /// Posts the specified request. /// </summary> /// <param name="request">The request.</param> public void Post(MarkFavoriteItem request) { var user = _userManager.GetUserById(request.UserId); var item = (Folder)DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager, user.Id); // Get the user data for this item var data = item.GetUserData(user, true); // Set favorite status data.IsFavorite = true; var task = _userManager.SaveUserDataForItem(user, item, data); Task.WaitAll(task); }
/// <summary> /// Posts the specified request. /// </summary> /// <param name="request">The request.</param> public void Post(MarkFavoriteItem request) { var user = _userManager.GetUserById(request.UserId); var item = string.IsNullOrEmpty(request.Id) ? user.RootFolder : DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager, user.Id); // Get the user data for this item var key = item.GetUserDataKey(); var data = _userDataRepository.GetUserData(user.Id, key); // Set favorite status data.IsFavorite = true; var task = _userDataRepository.SaveUserData(user.Id, key, data, CancellationToken.None); Task.WaitAll(task); }
/// <summary> /// Posts the specified request. /// </summary> /// <param name="request">The request.</param> public object Post(MarkFavoriteItem request) { var dto = MarkFavorite(request.UserId, request.Id, true); return(ToOptimizedResult(dto)); }
/// <summary> /// Posts the specified request. /// </summary> /// <param name="request">The request.</param> public async Task <object> Post(MarkFavoriteItem request) { var dto = await MarkFavorite(request.UserId, request.Id, true).ConfigureAwait(false); return(ToOptimizedResult(dto)); }