public IActionResult Index() { CategorieBDD categorieBDD = new CategorieBDD(); List <Categorie> categories = categorieBDD.GetAll(); GammeBDD gammeBDD = new GammeBDD(); List <Gamme> gammes = gammeBDD.GetAll(); BeerBDD beerBDD = new BeerBDD(); List <Beer> beers = beerBDD.GetAll(); BeersViewModel model = new BeersViewModel(); model.Beers = beers; model.Categories = categories; model.Gammes = gammes; return(View(model)); }
private void RefreshBeerListBox() { int index = this.BeerListBox.SelectedIndex; BeerBDD beerBDD = new BeerBDD(); List <Beer> beers = beerBDD.GetAll(); this.BeerListBox.ValueMember = "Identifiant"; this.BeerListBox.DisplayMember = "Libelle"; this.BeerListBox.DataSource = beers; if (index < beers.Count - 1 && index != -1) { this.BeerListBox.SelectedIndex = index; } }