public ActionResult EditEleve(Guid id) { EleveModels model; using (EleveRepository repository = new EleveRepository()) { IQueryable <Tutors> tuteurs = repository.GetTutors(); IQueryable <Classrooms> classes = repository.GetClasses(); IQueryable <Levels> niveaux = repository.GetNiveaux(); Pupils x = repository.GetPupilById(id); model = new EleveModels { mode = 0, state = short.MaxValue, firstName = x.FirstName, lastName = x.LastName, sexe = x.Sex, birthdayDate = x.BirthdayDate, tuteurId = x.Tutor_Id, classroomId = x.Classroom_Id, levelId = x.Level_Id, tuteurs = getListTuteurs(tuteurs), classes = getListClasses(classes), niveaux = getListNiveaux(niveaux) }; } return(View("CreateEleve", model)); }
// GET: /Eleves/CreateEleve public ActionResult CreateEleve(Guid?classe, Guid?level, Guid?tuteur) { EleveModels model; using (EleveRepository repository = new EleveRepository()) { IQueryable <Tutors> tuteurs = repository.GetTutors(); IQueryable <Classrooms> classes = repository.GetClasses(); IQueryable <Levels> niveaux = repository.GetNiveaux(); model = new EleveModels { mode = -1, tuteurs = getListTuteurs(tuteurs), classes = getListClasses(classes), niveaux = getListNiveaux(niveaux), }; if (classe != null) { model.classroomId = (Guid)classe; } if (level != null) { model.levelId = (Guid)level; } if (tuteur != null) { model.tuteurId = (Guid)tuteur; } } return(View(model)); }