public ActionResult Bloquer(int id) { FormBlocageArbre ba = new FormBlocageArbre(); /*ba.blocages = new BlocageServiceAPI().Donner(new ObjetDonnerListe { ienum = null, options=null }) * .Select(j => new SelectListItem {Selected=false, Text=j.nom, Value=j.id.ToString() }) * .ToList();*/ /*IEnumerable<string> d = new BlocageServiceAPI().Donner(new ObjetDonnerListe { ienum = null, options = null }).Select(j => j.nom); * ba.blocages = new SelectList(d, d.FirstOrDefault());*/ ba.blocages = new BlocageServiceAPI().Donner(new ObjetDonnerListe { ienum = null, options = null }); ba.id = id; return(View(ba)); }
public ActionResult Bloquer(int id, FormBlocageArbre e) { if (ModelState.IsValid) { BlocageArbre ba = new BlocageArbre(); ba.id = id; ba.idBloqueur = SessionUtilisateur.Utilisateur.id; /*object oo = e.blocages.SelectedValue; * oo = e.blocageChoisi; * * * ba.idBlocage = (int)new BlocageServiceAPI().DonnerParNom((string)oo);*/ ba.idBlocage = e.idBlocage; bool b = new ArbreServiceAPI().Bloquer(ba); if (b) { return(RedirectToAction("ListerTout")); } } return(View(e)); }