Example #1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var context = new SearchQueryContext();

            context.Database.Initialize(true);
        }
        public virtual ActionResult Top(string queryName = "", int number = 0)
        {
            var searchQueryViewModel =
                SearchQueryContext.GetSearchQueryViewModelAsync(BuildParameters(queryName, 1, null, null, number)).Result;

            if (searchQueryViewModel.ProductSearchResults.Pagination != null)
            {
                searchQueryViewModel.ProductSearchResults.Pagination.TotalNumberOfPages = 1;
                searchQueryViewModel.ProductSearchResults.Pagination.NextPage           = null;
            }

            return(View("SearchQueryTopResults", searchQueryViewModel));
        }
        protected ActionResult ExecuteSearchQuery(string emptyView, string filledView,
                                                  Func <SearchQueryViewModel, object> viewModelSelector, string queryName, int page,
                                                  string sortBy = null, string sortDirection = null)
        {
            var param     = BuildParameters(queryName, page, sortBy, sortDirection, SearchConfiguration.MaxItemsPerPage);
            var container =
                SearchQueryContext.GetSearchQueryViewModelAsync(param).Result;

            var viewName = container.ProductSearchResults.TotalCount <= 0 ? emptyView : filledView;

            var model = viewModelSelector.Invoke(container);

            return(View(viewName, model));
        }
Example #4
0
 public SearchQueryService()
 {
     this._db = new SearchQueryContext();
 }