示例#1
0
        public static ResultViewModels RvmCreate(SearchViewModel svm, List<Produits> result)
        {
            var pageSize = 30;
            var itemQty = result.Count();
            var temp = itemQty % pageSize;
            var pageQty = temp == 0 ? itemQty / pageSize : itemQty / pageSize + 1;

            ResultViewModels rvm = new ResultViewModels()
            {
                CurrentPage = 1,
                Result = result.Take(pageSize).ToList(),
                PageSize = pageSize,
                ItemsQty = itemQty,
                PageQty = pageQty,
                XmlSearchviewModel = svm.SerializeSearchViewModel(),
                BackToSearch=true,
            };
            return rvm;
        }
示例#2
0
 public ActionResult Compare(ResultViewModels CVM)
 {
     return View(CVM);
 }
示例#3
0
        public ViewResult RetourRecherche(ResultViewModels rvm)
        {
            var bci = new BreadCrumItem("Index", "Index", "");
            ListeBreadCrumItem.Add(bci);

            var svm = SearchViewModel.InitializeSVM();
            var svmres = SearchViewModel.UnserializeSearchViewModel(rvm.XmlSearchviewModel);
            svmres.ListeCategorie = svm.ListeCategorie;
            svmres.ListeContinents = svm.ListeContinents;

            string srcSC = "";
            int i = 0;
            if (svmres.idSousCategories != null)
                foreach (var item in svmres.idSousCategories)
                {
                    if (i != 0)
                    {
                        srcSC += "/";
                    }
                    srcSC += item.ToString();
                    i++;
                }
            string srcP = "";
            i = 0;
            if (svmres.idPays != null)
                foreach (var item in svmres.idPays)
                {
                    if (i != 0)
                    {
                        srcP += "/";
                    }
                    srcP += item.ToString();
                    i++;
                }

            ViewBag.PrixMaxSlider = Math.Ceiling((float)db.Produits.Max(x => x.Prix) / 1000) * 1000;

            ViewBag.listeSC = srcSC;
            if (svmres.idRegions != null)
                ViewBag.listeR = svmres.idRegions[0].ToString();
            ViewBag.listeP = srcP;

            return View("../Search/Index", svmres);
        }
示例#4
0
        public ActionResult Result(SearchViewModel svm)
        {
            var bci = new BreadCrumItem("Result", "Result", "");
            ListeBreadCrumItem.Add(bci);
            //ViewBag.PrixMaxSlider = Math.Ceiling((float)db.Produits.Max(x => x.Prix) / 1000) * 1000;

            var result = GetSearchResult(svm);
            var pageSize = 30;
            var itemQty = result.Count();
            var temp = itemQty % pageSize;
            var pageQty = temp == 0 ? itemQty / pageSize : itemQty / pageSize + 1;

            var rvm = new ResultViewModels()
            {
                CurrentPage = 1,
                Result = result.Take(pageSize).ToList(),
                PageSize = pageSize,
                ItemsQty = itemQty,
                PageQty = pageQty,
                BackToSearch = true,

                XmlSearchviewModel = svm.SerializeSearchViewModel(),

            };
            return View(rvm);
        }
示例#5
0
        public ViewResult Pagination(ResultViewModels rvm)
        {
            var bci = new BreadCrumItem("Result", "Result", "");
            ListeBreadCrumItem.Add(bci);

            var svm = SearchViewModel.UnserializeSearchViewModel(rvm.XmlSearchviewModel);

            var result = GetSearchResult(svm);
            var pageSize = 30;
            var itemQty = result.Count();
            var temp = itemQty % pageSize;
            var pageQty = temp == 0 ? itemQty / pageSize : itemQty / pageSize + 1;

            rvm.Result = result.Skip(pageSize * (rvm.CurrentPage - 1)).Take(pageSize).ToList();
            rvm.CurrentPage = rvm.CurrentPage;
            rvm.PageSize = pageSize;
            rvm.ItemsQty = itemQty;
            rvm.PageQty = pageQty;

            rvm.XmlSearchviewModel = svm.SerializeSearchViewModel();

            return View("Result", rvm);
        }