public IActionResult GetAllLogements() { List <ServiceLogment> nourittures = new List <ServiceLogment>(); nourittures = (List <ServiceLogment>)logementService.GetAllLogements(); return(View(nourittures)); }
public IActionResult Index() { List <ServiceNouritture> nourritures = new List <ServiceNouritture>(); List <ServiceLogment> logements = new List <ServiceLogment>(); List <Experience> experiences = new List <Experience>(); if (ExperienceService.GetAllExperienceDetails(null) != null) { experiences = ExperienceService.GetAllExperienceDetails(null).OrderBy(x => x.AvgRating).Take(5).ToList(); } else { experiences = null; } logements = LogementExtService.GetAllLogements().OrderBy(x => x.PrixParNuit).Take(6).ToList(); nourritures = NourritureExtService.GetAllLogements().OrderBy(x => x.Prix).Take(6).ToList(); HomeViewModel homeViewModel = new HomeViewModel(); homeViewModel.ListeExperience = experiences; homeViewModel.ListeLogement = logements; homeViewModel.ListeNourriture = nourritures; return(View(homeViewModel)); }