Beispiel #1
0
        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);
        }
Beispiel #2
0
        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));
        }