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); }
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); }
public SearchViewModel(BrowseViewModel parent) { foreach (PropertyInfo prop in parent.GetType().GetProperties()) { GetType().GetProperty(prop.Name).SetValue(this, prop.GetValue(parent, null), null); } }
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(); }
// 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); }
public static List<SearchResutPartialViewItem> GetSearchResult(BrowseViewModel bvm) { SearchViewModel svm = new SearchViewModel(bvm); return GetSearchResult(svm); }