示例#1
0
        /// <summary>
        /// Gets the item.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Task{BaseItemDto}.</returns>
        private BaseItemDto GetItem(GetMusicGenre request)
        {
            var dtoOptions = GetDtoOptions(AuthorizationContext, request);

            var item = GetMusicGenre(request.Name, LibraryManager, dtoOptions);

            if (!string.IsNullOrWhiteSpace(request.UserId))
            {
                var user = UserManager.GetUserById(request.UserId);

                return(DtoService.GetBaseItemDto(item, dtoOptions, user));
            }

            return(DtoService.GetBaseItemDto(item, dtoOptions));
        }
示例#2
0
        /// <summary>
        /// Gets the item.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Task{BaseItemDto}.</returns>
        private BaseItemDto GetItem(GetMusicGenre request)
        {
            var dtoOptions = GetDtoOptions(AuthorizationContext, request);

            var item = GetMusicGenre(request.Name, LibraryManager, dtoOptions);

            if (!request.UserId.Equals(Guid.Empty))
            {
                var user = UserManager.GetUserById(request.UserId);

                return(DtoService.GetBaseItemDto(item, dtoOptions, user));
            }

            return(DtoService.GetBaseItemDto(item, dtoOptions));
        }
        /// <summary>
        /// Gets the item.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Task{BaseItemDto}.</returns>
        private BaseItemDto GetItem(GetMusicGenre request)
        {
            var item = GetMusicGenre(request.Name, LibraryManager);

            var dtoOptions = GetDtoOptions(request);

            if (request.UserId.HasValue)
            {
                var user = UserManager.GetUserById(request.UserId.Value);

                return(DtoService.GetBaseItemDto(item, dtoOptions, user));
            }

            return(DtoService.GetBaseItemDto(item, dtoOptions));
        }
示例#4
0
        /// <summary>
        /// Gets the item.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Task{BaseItemDto}.</returns>
        private BaseItemDto GetItem(GetMusicGenre request)
        {
            var item = GetMusicGenre(request.Name, LibraryManager);

            // Get everything
            var fields = Enum.GetNames(typeof(ItemFields)).Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true));

            if (request.UserId.HasValue)
            {
                var user = UserManager.GetUserById(request.UserId.Value);

                return(DtoService.GetBaseItemDto(item, fields.ToList(), user));
            }

            return(DtoService.GetBaseItemDto(item, fields.ToList()));
        }
示例#5
0
        /// <summary>
        /// Gets the item.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Task{BaseItemDto}.</returns>
        private async Task <BaseItemDto> GetItem(GetMusicGenre request)
        {
            var item = await GetMusicGenre(request.Name, LibraryManager).ConfigureAwait(false);

            // Get everything
            var fields = Enum.GetNames(typeof(ItemFields)).Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true));

            var builder = new DtoBuilder(Logger, LibraryManager, UserDataRepository, ItemRepository);

            if (request.UserId.HasValue)
            {
                var user = UserManager.GetUserById(request.UserId.Value);

                return(await builder.GetBaseItemDto(item, fields.ToList(), user).ConfigureAwait(false));
            }

            return(await builder.GetBaseItemDto(item, fields.ToList()).ConfigureAwait(false));
        }
示例#6
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetMusicGenre request)
        {
            var result = GetItem(request);

            return(ToOptimizedResult(result));
        }
示例#7
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetMusicGenre request)
        {
            var result = GetItem(request);

            return(ToOptimizedSerializedResultUsingCache(result));
        }