/// <summary>
        /// Deletes the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public void Delete(DeleteUserItemRating 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);

            data.Rating = null;

            var task = _userManager.SaveUserDataForItem(user, item, data);

            Task.WaitAll(task);
        }
Esempio n. 2
0
        /// <summary>
        /// Deletes the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public void Delete(DeleteUserItemRating request)
        {
            var user = _userManager.GetUserById(request.UserId);

            var item = string.IsNullOrEmpty(request.Id) ? user.RootFolder : DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager, user.Id);

            var key = item.GetUserDataKey();

            // Get the user data for this item
            var data = _userDataRepository.GetUserData(user.Id, key);

            data.Rating = null;

            var task = _userDataRepository.SaveUserData(user.Id, key, data, CancellationToken.None);

            Task.WaitAll(task);
        }
Esempio n. 3
0
        /// <summary>
        /// Deletes the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public object Delete(DeleteUserItemRating request)
        {
            var dto = UpdateUserItemRating(request.UserId, request.Id, null);

            return(ToOptimizedResult(dto));
        }