Esempio n. 1
0
        public ActionResult Edit([Bind(Include = "discipline_id,responsable_discipline_id,label,description")] discipline discipline)
        {
            if (ModelState.IsValid)
            {
                db.Entry(discipline).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Redirect"));
            }
            //ViewBag.responsable_discipline_id = new SelectList(db.utilisateur, "utilisateur_id", "login", discipline.responsable_discipline_id);
            var responsables = new List <SelectListItem>();

            foreach (utilisateur u in db.utilisateur)
            {
                if (u.type_user == "encadrant")
                {
                    if (u.utilisateur_id == discipline.responsable_discipline_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.responsable_discipline_id = responsables;
            return(View(discipline));
        }
        public ActionResult Edit([Bind(Include = "utilisateur_id,login,password,prenom,nom,type_user,adresse,telephone")] utilisateur utilisateur)
        {
            if (ModelState.IsValid)
            {
                db.Entry(utilisateur).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            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.type_user = types;

            return(View(utilisateur));
        }
 public ActionResult Edit([Bind(Include = "lieu_id,label,adresse,capacite_max")] lieu lieu)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lieu).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(lieu));
 }
 public ActionResult Edit([Bind(Include = "document_id,utilisateur_id,type_document,path_document,valide")] document document)
 {
     if (ModelState.IsValid)
     {
         db.Entry(document).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.utilisateur_id = new SelectList(db.utilisateur, "utilisateur_id", "login", document.utilisateur_id);
     return(View(document));
 }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "utilisateur_id,seance_id,a_payer")] participe participe)
 {
     if (ModelState.IsValid)
     {
         db.Entry(participe).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.seance_id      = new SelectList(db.seance, "seance_id", "seance_id", participe.seance_id);
     ViewBag.utilisateur_id = new SelectList(db.utilisateur, "utilisateur_id", "login", participe.utilisateur_id);
     return(View(participe));
 }
Esempio n. 6
0
        public ActionResult Edit([Bind(Include = "seance_id,encadrant_id,lieu_id,section_id,places_max,heure_debut,heure_fin,jour_de_la_semaine")] 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", "label", 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.type_user == "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_de_la_semaine = jours;
            return(View(seance));
        }