示例#1
0
        public async Task <IActionResult> Index([FromQuery] FilterResponseViewModel viewModel)
        {
            viewModel.CurrentPage = viewModel.CurrentPage < 1 ? 1 : viewModel.CurrentPage;
            var userId = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value;

            int.TryParse(userId, out int id);
            var catalogViewModel = await _catalogViewModelService.GetFilteredCatalogItemsAsync(viewModel, id);

            ViewData["Categories"] = string.Join(",", viewModel.Categories);
            ViewData["Authors"]    = string.Join(",", viewModel.Authors);
            ViewData["Publishers"] = string.Join(",", viewModel.Publishers);
            _logger.LogDebug(string.Join(", ", viewModel.Publishers));

            return(View(catalogViewModel));
        }