protected virtual SearchViewModel <GenericNode> GetSearchModel(GenericNode currentContent)
 {
     return(_viewModelFactory.Create(currentContent, HttpContext.Request.QueryString["facets"], 0, new FilterOptionViewModel
     {
         FacetGroups = new List <FacetGroupOption>(),
         Page = 1,
         PageSize = currentContent.PartialPageSize
     }));
 }
Exemplo n.º 2
0
        public ActionResult Index(SearchResultPage currentPage, FilterOptionViewModel filterOptions)
        {
            if (filterOptions == null || filterOptions.Q.IsNullOrEmpty())
            {
                return(Redirect(Url.ContentUrl(ContentReference.StartPage)));
            }

            var selectedFacets = _httpContextAccessor.HttpContext.Request.Query["facets"];
            var viewModel      = _viewModelFactory.Create(currentPage, selectedFacets, 0, filterOptions);

            return(View(viewModel));
        }
Exemplo n.º 3
0
        public async Task <ViewResult> Index(GenericNode currentContent, CommerceFilterOptionViewModel viewModel)
        {
            var model = _viewModelFactory.Create <DemoSearchViewModel <GenericNode>, GenericNode>(currentContent, new CommerceArgs
            {
                FilterOption   = viewModel,
                SelectedFacets = HttpContext.Request.QueryString["facets"],
                CatalogId      = 0
            });

            if (HttpContext.Request.HttpMethod == "GET")
            {
                var response = await _recommendationService.TrackCategory(HttpContext, currentContent);

                model.Recommendations = response.GetCategoryRecommendations(_referenceConverter);
            }

            model.BreadCrumb = GetBreadCrumb(currentContent.Code);
            return(View(model));
        }
Exemplo n.º 4
0
        public async Task <ViewResult> Index(GenericNode currentContent, FilterOptionViewModel viewModel)
        {
            if (string.IsNullOrEmpty(viewModel.ViewSwitcher))
            {
                viewModel.ViewSwitcher = string.IsNullOrEmpty(currentContent.DefaultTemplate) ? "Grid" : currentContent.DefaultTemplate;
            }

            var model = _viewModelFactory.Create(currentContent,
                                                 HttpContext.Request.QueryString["facets"],
                                                 0,
                                                 viewModel);

            if (HttpContext.Request.HttpMethod == "GET")
            {
                var response = await _recommendationService.TrackCategory(HttpContext, currentContent);

                model.Recommendations = response.GetCategoryRecommendations(_referenceConverter);
            }

            model.BreadCrumb = GetBreadCrumb(currentContent.Code);
            return(View(model));
        }