public IActionResult GetAll(string[] searchTerm) { ViewBag.Best = ExperienceService.BestExperience(); string[] search = new string[10]; List <Experience> list = new List <Experience>(); if (!(searchTerm.Count() == 0)) { foreach (var ch in searchTerm) { var list2 = ExperienceService.GetAllExperienceDetails(ch).ToList(); list = list.Concat(list2).ToList(); } ; return(View(list)); } return(View(ExperienceService.GetAllExperienceDetails("").ToList())); }
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)); }