public ActionResult DeleteTuteur(Guid id) { TuteurModels model; using (TuteurRepository repository = new TuteurRepository()) { Tutors x = repository.GetTutorById(id); if (x == null) { return(HttpNotFound()); } model = new TuteurModels { id = x.Id, firstName = x.FirstName, lastName = x.LastName, mail = x.Mail, postCode = x.PostCode, comment = x.Comment, town = x.Town, tel = x.Tel, address = x.Address, // eleves = }; } return(View("DeleteTuteur", model)); }
public ActionResult ReadTuteur(Guid id) { TuteurModels model; using (TuteurRepository repository = new TuteurRepository()) { Tutors x = repository.GetTutorById(id); IQueryable <Pupils> l = repository.GetPupilsById(id); if (x == null) { return(HttpNotFound()); } model = new TuteurModels { id = x.Id, firstName = x.FirstName, lastName = x.LastName, mail = x.Mail, postCode = x.PostCode, comment = x.Comment, town = x.Town, tel = x.Tel, address = x.Address, pupils = getListEleves(l) }; } return(View(model)); }
public ActionResult EditTuteur(TuteurModels model) { using (TuteurRepository repository = new TuteurRepository()) { Tutors x = repository.GetTutorById(model.id); x.FirstName = model.firstName; x.LastName = model.lastName; x.Mail = model.mail; x.PostCode = model.postCode; x.Comment = model.comment; x.Town = model.town; x.Tel = model.tel; x.Address = model.address; // eleves = if (ModelState.IsValid) { repository.Save(); } return(RedirectToAction("ReadTuteurs")); } }