protected FilterPatemetersDto BuildParametersDto(int skipItems = 0, int pageSize = 2)
        {
            var filterParameters = new FilterPatemetersDto()
            {
                PageSize  = pageSize,
                SkipItems = skipItems
            };

            return(filterParameters);
        }
        public IActionResult GetOverviewItems([FromQuery] FilterPatemetersDto dto)
        {
            var response = _itemsDataService.GetItemsOverviewPageModel(this.UserId, dto);

            if (!response.IsSuccess)
            {
                return(BadRequest(response));
            }

            return(Ok(response));
        }
        private IQueryable <ItemOverviewDto> GetOverviewItemsQuery(string userId, FilterPatemetersDto dto)
        {
            var query = GetBaseQuery(userId);

            query = FilterBySearchWord(dto.SearchWord, query);

            query = FilterBySearchDate(dto.SearchDate, query);

            query = Sort(dto.OrderByColumn, dto.OrderByDirection, query);

            return(query);
        }
        public Response <ItemsOverviewPageDto> GetItemsOverviewPageModel(string userId, FilterPatemetersDto dto)
        {
            try
            {
                userId.ThrowIfNullOrEmpty();
                dto.ThrowIfNull();

                var query = GetOverviewItemsQuery(userId, dto);

                var dtos = query
                           .Skip(dto.SkipItems.Value)
                           .Take(dto.PageSize.Value)
                           .ToList();

                var itemsCount = query.Count();

                var pageDto = new ItemsOverviewPageDto()
                {
                    OverviewItems   = dtos,
                    TotalItemsCount = itemsCount
                };

                var response = ResponseBuilder.Success(pageDto);
                return(response);
            }
            catch (Exception ex)
            {
                var errorMessage = _localizer["OverviewItemsError"];
                var response     = ResponseBuilder.Failure <ItemsOverviewPageDto>(errorMessage);
                return(response);
            }
        }