public ActionResult Edit([Bind(Include = "utilisateur_id,login,password,prenom,nom,adresse,telephone,role_utilisateur")] utilisateur utilisateur) { if (ModelState.IsValid) { try { db.Entry(utilisateur).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception ex) { return(View()); } } var types = new List <SelectListItem>(); types.Add(new SelectListItem() { Text = "Adhérent", Value = "adherent", Selected = isMyRole(utilisateur, "adherent") }); types.Add(new SelectListItem() { Text = "Encadrant", Value = "encadrant", Selected = isMyRole(utilisateur, "encadrant") }); types.Add(new SelectListItem() { Text = "Administrateur", Value = "admin", Selected = isMyRole(utilisateur, "admin") }); ViewBag.role_utilisateur = types; return(View(utilisateur)); }
public ActionResult Edit([Bind(Include = "section_id,discipline_id,section_nom,encadrant_id,place_max,nbParticipant,prix,description")] section section) { if (ModelState.IsValid) { db.Entry(section).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.discipline_id = new SelectList(db.discipline, "discipline_id", "label", section.discipline_id); return(View(section)); }
public ActionResult Edit([Bind(Include = "discipline_id,discipline_nom,encadrant_id,description")] discipline discipline) { if (ModelState.IsValid) { _db.Entry(discipline).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); } return(View(discipline)); }
public ActionResult Edit([Bind(Exclude = "participe_id")] participe participe) { if (ModelState.IsValid) { try { db.Entry(participe).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } } return(View(participe)); }
public ActionResult Edit([Bind(Include = "lieu_id,lieu_nom,adresse_lieu")] lieu lieu) { if (ModelState.IsValid) { try { // TODO: Add update logic here db.Entry(lieu).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } } return(View(lieu)); }
public ActionResult Edit([Bind(Include = "dossier_id,utilisateur_id,certificat_medical,fiche_renseignement,assurance,paiement,dossier_complet")] dossier dossier) { if (ModelState.IsValid) { try { db.Entry(dossier).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } } ViewBag.utilisateur_id = new SelectList(db.utilisateur, "utilisateur_id", "login", dossier.utilisateur_id); return(View(dossier)); }
public ActionResult Edit([Bind(Include = "seance_id,lieu_id,encadrant_id,jour,heure_debut,heure_fin,section_id")] seance seance) { if (ModelState.IsValid) { db.Entry(seance).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.lieu_id = new SelectList(db.lieu, "lieu_id", "lieu_nom", seance.lieu_id); ViewBag.section_id = new SelectList(db.section, "section_id", "description", seance.section_id); var responsables = new List <SelectListItem>(); foreach (utilisateur u in db.utilisateur) { if (u.role_utilisateur == "encadrant") { if (u.utilisateur_id == seance.encadrant_id) { responsables.Add(new SelectListItem() { Text = u.prenom + " " + u.nom + " " + u.login, Value = "" + u.utilisateur_id, Selected = true }); } else { responsables.Add(new SelectListItem() { Text = u.prenom + " " + u.nom + " " + u.login, Value = "" + u.utilisateur_id, Selected = false }); } } } ViewBag.encadrant_id = responsables; ViewBag.encadrant_id = responsables; var jours = new List <SelectListItem>(); jours.Add(new SelectListItem() { Text = "Lundi", Value = "Lundi", Selected = isJourSelected(seance, "Lundi") }); jours.Add(new SelectListItem() { Text = "Mardi", Value = "Mardi", Selected = isJourSelected(seance, "Mardi") }); jours.Add(new SelectListItem() { Text = "Mercredi", Value = "Mercredi", Selected = isJourSelected(seance, "Mercredi") }); jours.Add(new SelectListItem() { Text = "Jeudi", Value = "Jeudi", Selected = isJourSelected(seance, "Jeudi") }); jours.Add(new SelectListItem() { Text = "Vendredi", Value = "Vendredi", Selected = isJourSelected(seance, "Vendredi") }); jours.Add(new SelectListItem() { Text = "Samedi", Value = "Samedi", Selected = isJourSelected(seance, "Samedi") }); jours.Add(new SelectListItem() { Text = "Dimanche", Value = "Dimanche", Selected = isJourSelected(seance, "Dimanche") }); ViewBag.jour = jours; return(View(seance)); }