Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("PfeID,Titre,Mention,Note")] Pfe pfe)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pfe);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pfe));
        }
        public async Task <IActionResult> Create([Bind("ProfesseurID,NomProf,PrenomProf,HireDate")] Professeur professeur)
        {
            if (ModelState.IsValid)
            {
                _context.Add(professeur);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(professeur));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("DepartementID,Name,Budget,StartDate")] Departement departement)
        {
            if (ModelState.IsValid)
            {
                _context.Add(departement);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(departement));
        }
        public async Task <IActionResult> Create([Bind("PlanningID,DateSoutenance,Salle")] Planning planning)
        {
            if (ModelState.IsValid)
            {
                _context.Add(planning);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(planning));
        }
        public async Task <IActionResult> Create([Bind("Nom,Prenom,Email,Tel,DateNaissance")] Etudiant etudiant)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(etudiant);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }
            return(View(etudiant));
        }