예제 #1
0
        public ActionResult Result(SearchViewModel svm)
        {
            //var db = new Form114Entities();
            //var liste = db.Produits;
            SearchBase sb = new Search();

            sb = new SearchOptionNombrePlaces(sb, svm.nbPlaces);
            sb = new SearchOptionPrixMini(sb, svm.PrixMini);
            sb = new SearchOptionDateDebut(sb, svm.DateDebut);
            //sb = new SearchOptionRegion(sb, svm.Region);
            sb = new SearchOptionVille(sb, svm.Ville);
            var result = sb.GetResult().ToList();
            ViewBag.PrixMini = svm.PrixMini;
            //int regionId = _db.Villes.Where(v => v.idVille == svm.Ville[0]).Select(v => v.Pays.idRegion).FirstOrDefault();
            //string paysId = _db.Pays.Where(p => p.Regions.idRegion == regionId).Select(p => p.CodeIso3).FirstOrDefault();
            //BCI.Add(new BreadCrumbItem("@regionId", "Result", "Search"));
            return View(result);
        }
예제 #2
0
        public ActionResult Result(SearchViewModel svm)
        {
            //var db = new Form114Entities();
            //var liste = db.Produits;
            SearchBase sb = new Search();

            sb = new SearchOptionNombrePlaces(sb, svm.nbPlaces);
            var result = sb.GetResult().OrderBy(p => p.IdProduit).ToList();
            sb = new SearchOptionPrixMini(sb, svm.PrixMini);
            result = sb.GetResult().ToList();
            if (DateTime.Compare(svm.DateDebut, DateTime.Now)>0)
                sb = new SearchOptionDateDebut(sb, svm.DateDebut);
            result = sb.GetResult().ToList();
            sb = new SearchOptionPays(sb, svm.Pays);
            result = sb.GetResult().ToList();
            sb = new SearchOptionRegion(sb, svm.Region);
            result = sb.GetResult().ToList();
            sb = new SearchOptionVille(sb, svm.Ville);
            result = sb.GetResult().OrderBy(p => p.IdProduit).ToList();

            Villes ville = null;
            Pays pays = null;
            Regions region = null;
            if (svm.Ville != null && svm.Ville[0] != 0)
            {
                ville = _db.Villes.Find(svm.Ville[0]);
                pays = _db.Villes.Find(ville.idVille).Pays;
                region = _db.Pays.Find(pays.CodeIso3).Regions;
            } else if (svm.Region != 0)
            {
                region = _db.Pays.Find(svm.Region).Regions;
                pays = _db.Villes.Find(region.idRegion).Pays;
            } else if (svm.Pays != null)
            {
                pays = _db.Villes.Find(svm.Pays).Pays;
            }
            BCI.Add(new BreadCrumbItem(region.name, "Index", "Regions", region.idRegion.ToString()));
            BCI.Add(new BreadCrumbItem(pays.Name, "Index", "Pays", pays.CodeIso3));
            BCI.Add(new BreadCrumbItem(ville.name, "Index", "Villes", ville.idVille.ToString()));
            ViewBag.PrixMini = svm.PrixMini;
            return View(result);
        }