private List <SelectListItem> regions() { RegionContext regionContext = new RegionContext(connectionString); List <Region> regions = regionContext.GetAll(); List <SelectListItem> selectListItem = new List <SelectListItem>(); foreach (Region region in regions) { selectListItem.Add(new SelectListItem(region.Nom, region.Identifiant.ToString())); } return(selectListItem); }
public IActionResult Index() { ViewBag.Title = "RĂ©gions"; RegionIndexViewModels model = new RegionIndexViewModels(); model.Title = "Les RĂ©gions sont :"; RegionContext regionContext = new RegionContext(connectionString); List <Region> regions = regionContext.GetAll(); model.Regions = regions; return(View(model)); }