コード例 #1
0
        //
        // GET: /GestionDesClasses/EditClasse/5

        public ActionResult EditClasse(Guid id)
        {
            ClasseModels model;

            using (ClasseRepository repository = new ClasseRepository())
            {
                IQueryable <Years>          years          = repository.GetYears();
                IQueryable <Users>          users          = repository.GetUsers();
                IQueryable <Establishments> etablissements = repository.GetEtablissements();
                Classrooms c = repository.GetClasseById(id);
                if (c == null)
                {
                    return(HttpNotFound());
                }
                model = new ClasseModels
                {
                    mode            = 0,
                    id              = c.Id,
                    title           = c.Title,
                    userId          = c.User_Id,
                    yearId          = c.Year_Id,
                    etablissementId = c.Establishment_Id,
                    users           = getListUsers(users),
                    years           = getListYears(years),
                    etablissements  = getListEtablissements(etablissements)
                };
            }
            return(View("CreateClasse", model));
        }
コード例 #2
0
        // GET: /GestionDesClasses/CreateClasse

        public ActionResult CreateClasse(Guid?etablissement, Guid?user, Guid?year)
        {
            ClasseModels model;

            using (ClasseRepository repository = new ClasseRepository())
            {
                IQueryable <Users>          users          = repository.GetUsers();
                IQueryable <Years>          years          = repository.GetYears();
                IQueryable <Establishments> etablissements = repository.GetEtablissements();
                model = new ClasseModels
                {
                    mode           = -1,
                    users          = getListUsers(users),
                    years          = getListYears(years),
                    etablissements = getListEtablissements(etablissements),
                };
                if (etablissement != null)
                {
                    model.etablissementId = (Guid)etablissement;
                }
                if (user != null)
                {
                    model.userId = (Guid)user;
                }
                if (year != null)
                {
                    model.yearId = (Guid)year;
                }
            }
            return(View(model));
        }