public ActionResult EditResultat(ResultatModels model)
        {
            using (ResultatRepository repository = new ResultatRepository())
            {
                Results x = repository.GetResultById(model.id);
                x.Evaluation_Id = model.evaluationId;
                x.Note          = model.note;
                x.Pupil_Id      = model.pupilId;

                if (ModelState.IsValid)
                {
                    repository.Save();
                }
                return(RedirectToAction("ReadResultats"));
            }
        }
 public ActionResult EditerResultats(ListeResultatsModels model)
 {
     foreach (var resultat in model.resultats)
     {
         using (ResultatRepository repository = new ResultatRepository())
         {
             Results r = repository.GetResultById(resultat.id);
             r.Pupil_Id      = resultat.pupilId;
             r.Note          = resultat.note;
             r.Evaluation_Id = resultat.evaluationId;
             if (ModelState.IsValid)
             {
                 repository.Save();
             }
         }
     }
     return(RedirectToAction("ReadEvaluations"));
 }
        public ActionResult ReadResultat(Guid id)
        {
            ResultatModels model;

            using (ResultatRepository repository = new ResultatRepository())
            {
                Results x = repository.GetResultById(id);
                if (x == null)
                {
                    return(HttpNotFound());
                }
                model = new ResultatModels
                {
                    id           = x.Id,
                    evaluationId = x.Evaluation_Id,
                    note         = x.Note,
                    pupilId      = x.Pupil_Id
                };
            }
            return(View(model));
        }
        public ActionResult EditResultat(Guid id)
        {
            ResultatModels model;

            using (ResultatRepository repository = new ResultatRepository())
            {
                Results x = repository.GetResultById(id);
                IQueryable <Evaluations> evaluations = repository.GetEvaluations();
                IQueryable <Pupils>      pupils      = repository.GetEleves();
                if (x == null)
                {
                    return(HttpNotFound());
                }
                model = new ResultatModels
                {
                    mode         = 0,
                    id           = x.Id,
                    evaluationId = x.Evaluation_Id,
                    note         = x.Note,
                    pupilId      = x.Pupil_Id
                };
            }
            return(View("CreateResultat", model));
        }