public ActionResult Create([Bind(Include = "idGrille,nom")] GrilleCours grilleCours) { if (ModelState.IsValid) { db.GrilleCours.Add(grilleCours); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(grilleCours)); }
public ActionResult Create([Bind(Include = "idProgramme,nom,annee,dateValidation,idDevis")] Programme programme) { if (ModelState.IsValid) { db.Programme.Add(programme); db.SaveChanges(); return(RedirectToAction("Create")); } ViewBag.idDevis = BuildDevisSelectList(); return(View(programme)); }
public ActionResult Create([Bind(Include = "idElement,description,numero,motClef,commentaire,idCompetence")] ElementCompetence elementCompetence) { AssignNo(elementCompetence); Trim(elementCompetence); if (ModelState.IsValid) { db.ElementCompetence.Add(elementCompetence); db.SaveChanges(); return(RedirectToAction("Create", "CriterePerformance", new { idElement = elementCompetence.idElement })); } return(View(elementCompetence)); }
public ActionResult Create([Bind(Include = "idCritere,description,numero,commentaire,idElement")] CriterePerformance criterePerformance) { AssignNo(criterePerformance); Trim(criterePerformance); if (ModelState.IsValid) { db.CriterePerformance.Add(criterePerformance); db.SaveChanges(); return(RedirectToAction("Create", new { idElement = criterePerformance.idElement })); } criterePerformance.ElementCompetence = db.ElementCompetence.Find(criterePerformance.idElement); return(View(criterePerformance)); }
public ActionResult Create([Bind(Include = "idContexte,description,commentaire,idCompetence")] ContexteRealisation contexteRealisation) { Trim(contexteRealisation); AssignNo(contexteRealisation); if (ModelState.IsValid) { db.ContexteRealisation.Add(contexteRealisation); db.SaveChanges(); return(RedirectToAction("Create", new { idCompetence = contexteRealisation.idCompetence })); } contexteRealisation.EnonceCompetence = db.EnonceCompetence.Find(contexteRealisation.idCompetence); return(View(contexteRealisation)); }
private void RemoveAllRCPAccesProgramme(ApplicationUser user) { BDPlanCadre bd = new BDPlanCadre(); bd.AccesProgramme.RemoveRange(bd.AccesProgramme.Where(e => e.userMail == user.UserName)); bd.SaveChanges(); }
public ActionResult Create([Bind(Include = "codeProgramme, annee, codeSpecialisation")] DevisMinistere devisMinistere) { bool existe; existe = db.DevisMinistere.Any(p => p.codeProgramme == devisMinistere.codeProgramme && p.annee == devisMinistere.annee && p.codeSpecialisation == devisMinistere.codeSpecialisation); if (!existe && ModelState.IsValid) { devisMinistere.codeSpecialisation = devisMinistere.codeSpecialisation.ToUpper(); db.DevisMinistere.Add(devisMinistere); db.SaveChanges(); return(RedirectToAction("Create")); } if (existe) { ModelState.AddModelError("Duplique", "Erreur, ce devis existe déjà."); } ViewBag.codeProgramme = BuildCodeDevisMinistereSelectList(); return(View(devisMinistere)); }
public ActionResult Create([Bind(Include = "idCompetence,codeCompetence,description,motClef,obligatoire,actif,commentaire,idDevis")] EnonceCompetence enonceCompetence) { bool existe; existe = db.EnonceCompetence.Any(ec => ec.codeCompetence == enonceCompetence.codeCompetence && ec.idDevis == enonceCompetence.idDevis); Trim(enonceCompetence); if (!existe && ModelState.IsValid) { enonceCompetence.codeCompetence = enonceCompetence.codeCompetence.ToUpper(); db.EnonceCompetence.Add(enonceCompetence); db.SaveChanges(); return(RedirectToAction("Create", "ContexteRealisation", new { idCompetence = enonceCompetence.idCompetence })); } if (existe) { ModelState.AddModelError("Duplique", "Erreur, un énoncé de compétence avec ce code existe déjà."); } return(View(enonceCompetence)); }
public ActionResult Create([Bind(Include = "idPlanCadre,numeroCours,titreCours,indicationPedago,environnementPhys,ressource,nbHeureTheorie,nbHeurePratique,nbHeureDevoir,idProgramme")] PlanCadre planCadre) { bool existe; existe = db.PlanCadre.Any(pc => pc.titreCours == planCadre.titreCours && pc.idProgramme == planCadre.idProgramme); //Trim(); if (!existe && ModelState.IsValid) { planCadre.titreCours = planCadre.titreCours.ToUpper(); planCadre.idType = 1; db.PlanCadre.Add(planCadre); db.SaveChanges(); return(RedirectToAction("info", "Programme", new { idProgramme = planCadre.idProgramme })); } if (existe) { ModelState.AddModelError("Duplique", "Erreur, un plan cadre avec ce nom existe déjà."); } return(View(planCadre)); }
private void CreateRCPAccesProgramme(ApplicationUser user, ICollection <string> codeProgramme) { BDPlanCadre bd = new BDPlanCadre(); foreach (string code in codeProgramme) { AccesProgramme accesProgramme = new AccesProgramme { userMail = user.UserName, codeProgramme = code }; bd.AccesProgramme.Add(accesProgramme); } bd.SaveChanges(); }
public ActionResult Edit([Bind(Include = "idDevis, codeProgramme, annee, codeSpecialisation, nom, dateValidation, docMinistere, specialisation, sanction, nbUnite, condition, nbHeurefrmGenerale,nbHeurefrmSpecifique")] DevisMinistere devisMinistere, HttpPostedFileBase docMinistere) { devisMinistere.EnteteProgramme = db.EnteteProgramme.Find(devisMinistere.codeProgramme); if (docMinistere != null) { if (!UploadFile(docMinistere, devisMinistere)) { ModelState.AddModelError("PDF", "Le fichier doit être de type PDF."); } } Trim(devisMinistere); if (ModelState.IsValid) { db.Entry(devisMinistere).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Info", "DevisMinistere", new { idDevis = devisMinistere.idDevis })); } return(View(devisMinistere)); }