コード例 #1
0
        public IActionResult Results(ConsumptionEventSearchModel searchModel)
        {
            searchModel.ItemsPerPage = searchModel.ResultsPerPage;

            var query = new ConsumptionEventSearchQueryEntity()
            {
                InventoryItemId  = searchModel.InventoryItemId,
                DateCreatedStart = searchModel.DateCreatedStart,
                DateCreatedEnd   = searchModel.DateCreatedEnd,
                ConsumedBy       = searchModel.ConsumedBy,
                OrderNumber      = searchModel.OrderNumber,
                ResultsPerPage   = searchModel.ResultsPerPage
            };

            var results = _eventService.FindConsumptionSearchResults(query);

            var filterResults = results
                                .Skip((searchModel.CurrentPage - 1) * searchModel.ItemsPerPage)
                                .Take(searchModel.ItemsPerPage)
                                .ToList();

            var presentation = new ConsumptionEventSearchResultsModel
            {
                CurrentPage  = searchModel.CurrentPage,
                Events       = filterResults,
                ItemsPerPage = searchModel.ResultsPerPage,
                TotalItems   = (results.Count() > 0 ? results.Count() : 1)
            };

            return(View(presentation));
        }
コード例 #2
0
        public IActionResult Results(ConsumptionEventSearchModel searchModel)
        {
            searchModel.ItemsPerPage = searchModel.ResultsPerPage;
            var results = _eventService.FindConsumptionSearchResults(searchModel);

            var filterResults = results
                                .Skip((searchModel.CurrentPage - 1) * searchModel.ItemsPerPage)
                                .Take(searchModel.ItemsPerPage)
                                .ToList();

            var presentation = new ConsumptionEventSearchResultsModel
            {
                CurrentPage  = searchModel.CurrentPage,
                Events       = filterResults,
                ItemsPerPage = searchModel.ResultsPerPage,
                TotalItems   = (results.Count() > 0 ? results.Count() : 1)
            };

            return(View(presentation));
        }