public ActionResult AdminIndex(string currentFilter, string searchString, int?categoryId, int?page)
        {
            var pageNumber = page ?? 1;

            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            var objectsPerPage = 20;
            var searchResult   = _categoryRepository.Get(new SearchParamsCategory
            {
                StartIndex   = (pageNumber - 1) * objectsPerPage,
                ObjectsCount = objectsPerPage,
                SearchString = searchString
            });

            ViewBag.CurrentFilter = searchString;
            var viewModel = SearchResultViewModel <Category> .CreateFromSearchResult(searchResult, i => i, 10);

            return(View(viewModel));
        }
Beispiel #2
0
        public ActionResult Index(int?page)
        {
            var pageNumber                = page ?? 1;
            var objectsPerPage            = 20;
            var startIndex                = (pageNumber - 1) * objectsPerPage;
            SearchParamsBase SearchParams = new SearchParamsBase(startIndex, objectsPerPage);
            var searchResult              = _filterRepository.Get(SearchParams);
            var viewModel = SearchResultViewModel <Pyramid.Entity.Filter> .CreateFromSearchResult(searchResult, i => i, 10);

            return(View(viewModel));
        }
        public ActionResult GlobalSearch(string currentFilter, string searchString, int?page)
        {
            var pageNumber = page ?? 1;

            if (string.IsNullOrWhiteSpace(searchString))
            {
                searchString = null;
            }
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            var objectsPerPage = 20;
            var startIndex     = (pageNumber - 1) * objectsPerPage;

            SearchParamsProduct SearchParams = new SearchParamsProduct(searchString, startIndex, objectsPerPage)
            {
                IsSearchOnlyPublicProduct = true
            };
            SearchResult <Product> searchResult;

            if (searchString == null)
            {
                searchResult = new SearchResult <Product>()
                {
                    Objects             = new List <Product>(),
                    RequestedStartIndex = 0,
                    Total = objectsPerPage,
                    RequestedObjectsCount = objectsPerPage
                };
            }
            else
            {
                searchResult = _productRepository.Get(SearchParams);
            }

            ViewBag.CurrentFilter = searchString;
            var viewModel = SearchResultViewModel <Product> .CreateFromSearchResult(searchResult, i => i, 10);

            List <BreadCrumbViewModel> breadcrumbs = new List <BreadCrumbViewModel>();

            breadcrumbs.Add(new BreadCrumbViewModel()
            {
                Title = "Поиск"
            });
            ViewBag.BredCrumbs = breadcrumbs;
            ViewBag.MetaTitle  = "Поиск: " + searchString;
            return(View(viewModel));
        }
        public ActionResult PartialGetReviewsByProductId(int productid, int?page)
        {
            ViewBag.ProductId = productid;
            var pageNumber     = page ?? 1;
            var objectsPerPage = 20;
            var searchResult   = _reviewRepository.Get(new SearchParamsReview(productid, (pageNumber - 1) * objectsPerPage, objectsPerPage));

            ViewBag.ProductId = productid;

            var viewModel = SearchResultViewModel <Review> .CreateFromSearchResult(searchResult, i => i, 10);

            return(PartialView("_PartialProductReviews", viewModel));
        }
Beispiel #5
0
        public ActionResult PartialSelectImage(int?page)
        {
            var pageNumber = page ?? 1;

            var objectsPerPage = 20;
            var searchResult   = _imageRepository.Get(new SearchParamsImage
            {
                StartIndex   = (pageNumber - 1) * objectsPerPage,
                ObjectsCount = objectsPerPage,
            });
            var viewModel = SearchResultViewModel <Image> .CreateFromSearchResult(searchResult, i => i, 10);

            // return View(viewModel);

            return(PartialView("_PartialSelectImage", viewModel));
        }
Beispiel #6
0
        public ActionResult Index(int?page)
        {
            var pageNumber = page ?? 1;

            var objectsPerPage = 20;
            var searchResult   = _imageRepository.Get(new SearchParamsImage
            {
                StartIndex   = (pageNumber - 1) * objectsPerPage,
                ObjectsCount = objectsPerPage,
            });
            var viewModel = SearchResultViewModel <Image> .CreateFromSearchResult(searchResult, i => i, 10);

            return(View(viewModel));
            //var model = DBFirstDAL.ImageDAL.GetAll();
            //return View(model);
        }
Beispiel #7
0
        public ActionResult Index(int?page)
        {
            var pageNumber = page ?? 1;

            var objectsPerPage = Config.PageSize;
            var startIndex     = (pageNumber - 1) * objectsPerPage;


            var searchResult = _orederRepository.Get(new SearchParamsOrder(startIndex, objectsPerPage)
            {
                SortByDate = true
            });

            var viewModel = SearchResultViewModel <Pyramid.Entity.Order> .CreateFromSearchResult(searchResult, i => i, 10);

            return(View(viewModel));
        }
        public ActionResult AdminIndex(int?page)
        {
            var pageNumber     = page ?? 1;
            var objectsPerPage = 20;
            var searchResult   = _recommendationRepository.Get(new SearchParamsBase
            {
                StartIndex   = (pageNumber - 1) * objectsPerPage,
                ObjectsCount = objectsPerPage,
            });

            var viewModel = SearchResultViewModel <Recommendation> .CreateFromSearchResult(searchResult, i => i, 10);

            return(View(viewModel));

            //var model = _recommendationRepository.GetAll();
            //return View(model);
        }
        public ActionResult AdminIndex(string productTitle, string currentFilter, bool?isApproved, bool?isNotRead, int?page)
        {
            var pageNumber = page ?? 1;

            if (productTitle != null)
            {
                page = 1;
            }
            else
            {
                productTitle = currentFilter;
            }
            var objectsPerPage = 20;
            var searchResult   = _reviewRepository.Get(new SearchParamsReview(productTitle, isApproved, isNotRead, (pageNumber - 1) * objectsPerPage, objectsPerPage));

            ViewBag.CurrentFilter = productTitle;
            ViewBag.IsApproved    = isApproved;
            ViewBag.IsRead        = isNotRead;

            var viewModel = SearchResultViewModel <Review> .CreateFromSearchResult(searchResult, i => i, 10);

            return(View(viewModel));
        }
        public ActionResult Index(int?page)
        {
            var pageNumber     = page ?? 1;
            var objectsPerPage = 20;
            var searchResult   = _recommendationRepository.Get(new SearchParamsBase
            {
                StartIndex   = (pageNumber - 1) * objectsPerPage,
                ObjectsCount = objectsPerPage,
            });

            var viewModel = SearchResultViewModel <Recommendation> .CreateFromSearchResult(searchResult, i => i, 10);

            ViewBag.Banners = _eventBannerRepository.GetAll();
            List <BreadCrumbViewModel> breadcrumbs = new List <BreadCrumbViewModel>();

            breadcrumbs.Add(new BreadCrumbViewModel()
            {
                Title = "Советы"
            });
            ViewBag.BredCrumbs = breadcrumbs;
            ViewBag.MetaTitle  = "Советы";
            return(View(viewModel));
        }
Beispiel #11
0
        public ActionResult AdminIndex(string currentFilter, string searchString, int?categoryId, int?page, bool priority = false, int filled = 0, bool isNotUnloading1C = false)
        {
            var pageNumber = page ?? 1;

            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            var objectsPerPage = 20;
            var startIndex     = (pageNumber - 1) * objectsPerPage;

            SearchParamsProduct SearchParams = new SearchParamsProduct(searchString, categoryId, priority, filled, startIndex, objectsPerPage);

            SearchParams.IsNotUnloading1C = isNotUnloading1C;

            var searchResult = _productRepository.Get(SearchParams);

            ViewBag.CurrentFilter            = searchString;
            ViewBag.CategoryId               = categoryId;
            ViewBag.Filled                   = (Common.TypeFilledProduct)filled;
            ViewBag.Priority                 = priority;
            ViewBag.IsNotUnloading1C         = isNotUnloading1C;
            ViewBag.CategoriesSelectListItem = _categoryRepository.GetAll().Select(item => new SelectListItem
            {
                Text  = item.Title,
                Value = item.Id.ToString()
            });

            var viewModel = SearchResultViewModel <Product> .CreateFromSearchResult(searchResult, i => i, 10);

            return(View(viewModel));
        }