示例#1
0
        public ActionResult Create([Bind(Include = "utilisateur_id,login,password,prenom,nom,adresse,telephone,role_utilisateur")] utilisateur utilisateur)
        {
            if (ModelState.IsValid)
            {
                db.utilisateur.Add(utilisateur);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            var types = new List <SelectListItem>();

            types.Add(new SelectListItem()
            {
                Text = "Adhérent", Value = "adherent"
            });
            types.Add(new SelectListItem()
            {
                Text = "Encadrant", Value = "encadrant"
            });
            types.Add(new SelectListItem()
            {
                Text = "Administrateur", Value = "admin"
            });

            ViewBag.role_utilisateur = types;

            return(View(utilisateur));
        }
        public ActionResult Create([Bind(Include = "seance_id,lieu_id,encadrant_id,jour,heure_debut,heure_fin,section_id")] seance seance)
        {
            if (ModelState.IsValid)
            {
                db.seance.Add(seance);
                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);
            //ViewBag.encadrant_id = new SelectList(db.utilisateur, "utilisateur_id", "login", seance.encadrant_id);
            var responsables = new List <SelectListItem>();

            foreach (utilisateur u in db.utilisateur)
            {
                if (u.role_utilisateur == "encadrant")
                {
                    responsables.Add(new SelectListItem()
                    {
                        Text = u.prenom + " " + u.nom + " " + u.login, Value = "" + u.utilisateur_id
                    });
                }
            }
            ViewBag.encadrant_id = responsables;
            var jours = new List <SelectListItem>();

            jours.Add(new SelectListItem()
            {
                Text = "Lundi", Value = "Lundi"
            });
            jours.Add(new SelectListItem()
            {
                Text = "Mardi", Value = "Mardi"
            });
            jours.Add(new SelectListItem()
            {
                Text = "Mercredi", Value = "Mercredi"
            });
            jours.Add(new SelectListItem()
            {
                Text = "Jeudi", Value = "Jeudi"
            });
            jours.Add(new SelectListItem()
            {
                Text = "Vendredi", Value = "Vendredi"
            });
            jours.Add(new SelectListItem()
            {
                Text = "Samedi", Value = "Samedi"
            });
            jours.Add(new SelectListItem()
            {
                Text = "Dimanche", Value = "Dimanche"
            });

            ViewBag.jour = jours;
            return(View(seance));
        }
        public ActionResult Create([Bind(Exclude = "section_id")] section section)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            try
            {
                db.section.Add(section);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create([Bind(Exclude = "discipline_id")] discipline discipline)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            try
            {
                _db.discipline.Add(discipline);
                _db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create([Bind(Exclude = "participe_id")] participe participe)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    db.participe.Add(participe);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                catch
                {
                    return(View());
                }
            }


            return(View(participe));
        }
        public ActionResult Create([Bind(Include = "lieu_id,lieu_nom,adresse_lieu")] lieu lieu)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    // TODO: Add insert logic here
                    db.lieu.Add(lieu);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                catch
                {
                    return(View());
                }
            }

            return(View(lieu));
        }
        public ActionResult Create([Bind(Include = "dossier_id,utilisateur_id,certificat_medical,fiche_renseignement,assurance,paiement,dossier_complet")] dossier dossier)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    db.dossier.Add(dossier);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                catch
                {
                    return(View());
                }
            }

            ViewBag.utilisateur_id = new SelectList(db.utilisateur, "utilisateur_id", "login", dossier.utilisateur_id);
            return(View(dossier));
        }