public ActionResult Modifier(int id) { ArbreServiceAPI rs = new ArbreServiceAPI(); ArbreModification r = new ArbreModification(rs.Donner(id)); return(View(r)); }
public static Arbre VersArbre(this ArbreModification e) { if (e == null) { return(null); } return(new Arbre { id = e.id, nom = e.nom, description = e.description }); }
public ActionResult Modifier(int id, ArbreModification rm) { if (ModelState.IsValid) { ArbreServiceAPI rsa = new ArbreServiceAPI(); Arbre a = rsa.Donner(id); Arbre r = rm.VersArbre(); r.id = a.id; bool b = rsa.Modifier(id, r); if (b) { return(RedirectToAction("Index")); } } return(View(rm)); }