示例#1
0
        // GET: /GestionDesClasses/ReadClasse/1122
        public ActionResult ReadClasse(Guid id)
        {
            ClasseModels model;

            using (ClasseRepository repository = new ClasseRepository())
            {
                Classrooms c = repository.GetClasseById(id);
                //IQueryable<Users> l = repository.GetUserById(id);
                IQueryable <Pupils>      l = repository.GetPupilsById(id);
                IQueryable <Evaluations> e = repository.GetEvaluations(c.Id);
                if (c == null)
                {
                    return(HttpNotFound());
                }
                model = new ClasseModels
                {
                    id                = c.Id,
                    title             = c.Title,
                    userId            = c.User_Id,
                    yearId            = c.Year_Id,
                    etablissementId   = c.Establishment_Id,
                    userName          = c.Users.UserName,
                    yearName          = c.Years.Year,
                    etablissementName = c.Establishments.Name,
                    pupils            = getListEleves(l),
                    evaluations       = getListEvaluations(e)
                };
            }
            return(View(model));
        }