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

            var item = GetGameGenre(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));
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the item.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Task{BaseItemDto}.</returns>
        private BaseItemDto GetItem(GetGameGenre request)
        {
            var item = GetGameGenre(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));
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the item.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Task{BaseItemDto}.</returns>
        private BaseItemDto GetItem(GetGameGenre request)
        {
            var dtoOptions = GetDtoOptions(AuthorizationContext, request);

            var item = GetGameGenre(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));
        }
Esempio n. 4
0
        /// <summary>
        /// Gets the item.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Task{BaseItemDto}.</returns>
        private BaseItemDto GetItem(GetGameGenre request)
        {
            var item = GetGameGenre(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.GetItemByNameDto(item, fields.ToList(), user));
            }

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

            // 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(await DtoService.GetBaseItemDto(item, fields.ToList(), user).ConfigureAwait(false));
            }

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

            return(ToOptimizedSerializedResultUsingCache(result));
        }
Esempio n. 7
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetGameGenre request)
        {
            var result = GetItem(request);

            return(ToOptimizedResult(result));
        }