/// <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));
        }
        /// <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));
        }
Beispiel #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));
        }
Beispiel #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()));
        }
        /// <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));
        }
        /// <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));
        }
        /// <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));
        }