Esempio n. 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);
            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);
        }
Esempio n. 2
0
 public ActionResult ResultRegion(int id)
 {
     SearchBase sb = new Search();
     string NomRegion = _db.Regions.Find(id).name;
     sb = new SearchOptionRegion(sb, id);
     var result = sb.GetResult().ToList();
     BCI.Add(new BreadCrumbItem( NomRegion, "Result", "Search"));
     return View("Result",result);
 }