public async Task <IActionResult> Create([Bind("Id,IdTypeCarte,Code")] CarteIdentite carteIdentite)
        {
            if (ModelState.IsValid)
            {
                _context.Add(carteIdentite);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdTypeCarte"] = new SelectList(_context.TypeCarte, "Id", "Id", carteIdentite.IdTypeCarte);
            return(View(carteIdentite));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,IdCarte,IdAdresse,IdCompte,IdRelation,Nom,Prenom,Telephone,DateNaissance")] Citoyen citoyen)
        {
            if (ModelState.IsValid)
            {
                _context.Add(citoyen);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdAdresse"]  = new SelectList(_context.Adresse, "Id", "Id", citoyen.IdAdresse);
            ViewData["IdCarte"]    = new SelectList(_context.CarteIdentite, "Id", "Id", citoyen.IdCarte);
            ViewData["IdCompte"]   = new SelectList(_context.Compte, "Id", "Id", citoyen.IdCompte);
            ViewData["IdRelation"] = new SelectList(_context.Relation, "Id", "Id", citoyen.IdRelation);
            return(View(citoyen));
        }