コード例 #1
0
        public JsonResult GetJsonBestHotels(int continent, int region, string pays, int ville)
        {
            var bvm = new BrowseViewModel
                {
                    Continent = continent,
                    Region = region,
                    Pays = pays,
                    Ville = ville
                };

            // TODO change to SearchResutPartialViewItem serializé ??
            return Json(SearchController.GetSearchResult(bvm)
                                        .OrderByDescending(o => o.Hotel.NbReservations)
                                        .Select(o => new
                                                     {
                                                         hotel =  new {
                                                                           nom = o.Hotel.Nom,
                                                                           ville = o.Hotel.Villes.name.Trim(),
                                                                           categorie = o.Hotel.Categorie.Value,
                                                                           photo = o.Hotel.Photo,
                                                                           id = o.Hotel.IdHotel
                                                                      },
                                                         produits = o.Produits
                                                                      .Select(p => new {
                                                                                            dateDepart = p.DateDepart.ToString("dd/MM/yyyy"),
                                                                                            prix = p.Promotion == 0 ? p.Prix : p.PrixSolde,
                                                                                            duree = p.Sejours.Duree
                                                                                        })
                                                                      .OrderBy(op => op.prix)
                                                     }
                                               )
                                        .Take(2).ToList(), JsonRequestBehavior.AllowGet);
        }
コード例 #2
0
 public static List<SearchResutPartialViewItem> GetSearchResult(BrowseViewModel bvm)
 {
     SearchBase s = new Search();
     s = new SearchOptionDestination(s, bvm.Continent, bvm.Region, bvm.Pays, bvm.Ville);
     s = new SearchOptionAPartirDAujourdHui(s);
     return OrderingGroupResult(s);
 }
コード例 #3
0
 public SearchViewModel(BrowseViewModel parent)
 {
     foreach (PropertyInfo prop in parent.GetType().GetProperties())
     {
         GetType().GetProperty(prop.Name).SetValue(this, prop.GetValue(parent, null), null);
     }
 }
コード例 #4
0
 public SearchViewModel(BrowseViewModel parent)
 {
     foreach (PropertyInfo prop in parent.GetType().GetProperties())
     {
         GetType().GetProperty(prop.Name).SetValue(this, prop.GetValue(parent, null), null);
     }
 }
コード例 #5
0
        public List<Hotels> GetHotelsList(int continent, int region, string pays, int ville)
        {
            var bvm = new BrowseViewModel
            {
                Continent = continent,
                Region = region,
                Pays = pays,
                Ville = ville
            };

            // TODO change to SearchResutPartialViewItem serializé ??
            return SearchController.GetSearchResult(bvm).Select(p => p.Hotel).ToList();
        }
コード例 #6
0
        // GET: Browse
        public ActionResult Index()
        {
            var bvm = new BrowseViewModel();

            ViewBag.BestHotels = SearchController.GetSearchResult(bvm).OrderByDescending(o => o.Hotel.NbReservations).Take(2).ToList();

            return View(bvm);
        }
コード例 #7
0
 public static List<SearchResutPartialViewItem> GetSearchResult(BrowseViewModel bvm)
 {
     SearchViewModel svm = new SearchViewModel(bvm);
     return GetSearchResult(svm);
 }