public ActionResult ModifierAbsence1() { int?id = Convert.ToInt32(TempData["idetud"]); Repository <Cour> _repcour = new Repository <Cour>(AppConfig.DbConnexionString); Absenccess Lnotes = new Absenccess(); Repository <Presence> _repradbtn = new Repository <Presence>(AppConfig.DbConnexionString); List <Presence> _etudiant = _repradbtn.GetAll(v => v.Idetudiant == id && v.IdSemestre == 2, false).ToList(); Lnotes.ListePresence = _etudiant; List <string> cours = new List <string>(); foreach (Presence e in _etudiant) { { string cour = _repcour.GetSingle(x => x.IdCour == e.IdCour, false).Libelle; cours.Add(cour); } ViewBag.IDCour = cours; } return(View(Lnotes)); }
public ActionResult ModifierAbsence1(Absenccess Lnotes) { Repository <Presence> _repNote = new Repository <Presence>(AppConfig.DbConnexionString); List <Presence> _notes = _repNote.GetAll(null, false).ToList(); foreach (Presence p in Lnotes.ListePresence) { p.Absence = p.IsPresnece; _repNote.Update(p); } return(RedirectToAction("Index")); }