Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,nom,prenom,age")] Etudiant etudiant)
        {
            if (id != etudiant.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(etudiant);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EtudiantExists(etudiant.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(etudiant));
        }
        public async Task <IActionResult> Create([Bind("EtudiantId,Nom,Prenom,cin")] Etudiant etudiant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(etudiant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(etudiant));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("ClasseId,niveau,nbrEtudiant")] Classe classe)
        {
            if (ModelState.IsValid)
            {
                _context.Add(classe);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(classe));
        }
        public async Task <IActionResult> Create([Bind("SalleTypeId,name")] SalleType salleType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(salleType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(salleType));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("SalleId,SalleTypeId,numero,nbrPlace")] Salle salle)
        {
            if (ModelState.IsValid)
            {
                _context.Add(salle);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SalleTypeId"] = new SelectList(_context.Type, "SalleTypeId", "SalleTypeId", salle.SalleTypeId);
            return(View(salle));
        }
        public async Task <IActionResult> Create([Bind("CourId,name,EnseignantId,SalleId")] Cour cour)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cour);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EnseignantId"] = new SelectList(_context.Enseignants, "EnseignantId", "cin", cour.EnseignantId);
            ViewData["SalleId"]      = new SelectList(_context.Salles, "SalleId", "SalleId", cour.SalleId);
            return(View(cour));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Create([Bind("EnseigneId,ClasseId,EnseignantId")] Enseigne enseigne)
        {
            if (ModelState.IsValid)
            {
                _context.Add(enseigne);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClasseId"]     = new SelectList(_context.Classes, "ClasseId", "ClasseId", enseigne.ClasseId);
            ViewData["EnseignantId"] = new SelectList(_context.Enseignants, "EnseignantId", "cin", enseigne.EnseignantId);
            return(View(enseigne));
        }
Exemplo n.º 8
0
        public async Task <IActionResult> Create([Bind("AbsenceId,Date,EtudiantId,CourId")] Absence absence)
        {
            if (ModelState.IsValid)
            {
                _context.Add(absence);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourId"]     = new SelectList(_context.Cours, "CourId", "name", absence.CourId);
            ViewData["EtudiantId"] = new SelectList(_context.Etudiants, "EtudiantId", "cin", absence.EtudiantId);
            return(View(absence));
        }