Example #1
0
        public ActionResult Create([Bind(Include = "section_id,discipline_id,label,description,prix,responsable_id")] section section)
        {
            if (ModelState.IsValid)
            {
                db.section.Add(section);
                db.SaveChanges();
                return(RedirectToAction("Redirect"));
            }

            ViewBag.discipline_id = new SelectList(db.discipline, "discipline_id", "label", section.discipline_id);
            var responsables = new List <SelectListItem>();

            foreach (utilisateur u in db.utilisateur)
            {
                if (u.type_user == "encadrant")
                {
                    responsables.Add(new SelectListItem()
                    {
                        Text = u.prenom + " " + u.nom + " " + u.login, Value = "" + u.utilisateur_id
                    });
                }
            }
            ViewBag.responsable_id = responsables;
            return(View(section));
        }
Example #2
0
        public ActionResult Create([Bind(Include = "discipline_id,responsable_discipline_id,label,description")] discipline discipline)
        {
            if (ModelState.IsValid)
            {
                db.discipline.Add(discipline);
                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")
                {
                    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 Create([Bind(Include = "utilisateur_id,login,password,prenom,nom,type_user,adresse,telephone")] 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.type_user = types;

            return(View(utilisateur));
        }
Example #4
0
        public ActionResult Create([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.seance.Add(seance);
                db.SaveChanges();
                return(RedirectToAction("Redirect"));
            }

            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);
            //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.type_user == "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_de_la_semaine = jours;
            return(View(seance));
        }
        public ActionResult Create([Bind(Include = "lieu_id,label,adresse,capacite_max")] lieu lieu)
        {
            if (ModelState.IsValid)
            {
                db.lieu.Add(lieu);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(lieu));
        }
        public ActionResult Create([Bind(Include = "document_id,utilisateur_id,type_document,path_document,valide")] document document)
        {
            if (ModelState.IsValid)
            {
                db.document.Add(document);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.utilisateur_id = new SelectList(db.utilisateur, "utilisateur_id", "login", document.utilisateur_id);
            return(View(document));
        }
Example #7
0
        public ActionResult Create([Bind(Include = "utilisateur_id,seance_id,a_payer")] participe participe)
        {
            if (ModelState.IsValid)
            {
                db.participe.Add(participe);
                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));
        }