Esempio n. 1
0
        /// <summary>
        /// Gets the item.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Task{BaseItemDto}.</returns>
        private BaseItemDto GetItem(GetYear request)
        {
            var item = LibraryManager.GetYear(request.Year);

            var dtoOptions = GetDtoOptions(AuthorizationContext, request);

            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(GetYear request)
        {
            var item = LibraryManager.GetYear(request.Year);

            var dtoOptions = GetDtoOptions(request);

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

                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(GetYear request)
        {
            var item = LibraryManager.GetYear(request.Year);

            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. 4
0
        /// <summary>
        /// Gets the item.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Task{BaseItemDto}.</returns>
        private async Task <BaseItemDto> GetItem(GetYear request)
        {
            var item = await LibraryManager.GetYear(request.Year).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. 5
0
        /// <summary>
        /// Gets the item.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Task{BaseItemDto}.</returns>
        private BaseItemDto GetItem(GetYear request)
        {
            var item = LibraryManager.GetYear(request.Year);

            // 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()));
        }
Esempio n. 6
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetYear 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(GetYear request)
        {
            var result = GetItem(request);

            return(ToOptimizedResult(result));
        }