Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,nom,prenom,dateNaissance,sexe,role")] Personne personne)
        {
            if (ModelState.IsValid)
            {
                _context.Add(personne);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(personne));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,Marque,NumLot,DateInjection,DateRappel,TypeVaccin")] Injections injections)
        {
            if (ModelState.IsValid)
            {
                _context.Add(injections);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(injections));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,Nom,Prenom,Sexe,DateNaissance,TypePersonne")] Personnes personnes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(personnes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(personnes));
        }
        public async Task <IActionResult> Create([Bind("Id,Libelle,Description")] Categorie categorie)
        {
            if (ModelState.IsValid)
            {
                _context.Add(categorie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(categorie));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("Id,dateInjection,dateRappel,numLot,marque")] Injection injection)
        {
            if (ModelState.IsValid)
            {
                _context.Add(injection);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(injection));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Create([Bind("Id,Nom")] Vaccin vaccin)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vaccin);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vaccin));
        }
        public async Task <IActionResult> Create([Bind("InjectionsId,PersonnesId")] InjectionsPersonnes injectionsPersonnes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(injectionsPersonnes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["InjectionsId"] = new SelectList(_context.Injections, "Id", "Id", injectionsPersonnes.InjectionsId);
            ViewData["PersonnesId"]  = new SelectList(_context.Personnes, "Id", "Id", injectionsPersonnes.PersonnesId);
            return(View(injectionsPersonnes));
        }
Exemplo n.º 8
0
        public async Task <IActionResult> Create([Bind("VetementId,Nom")] Vetement vetement)
        {
            if (ModelState.IsValid)
            {
                vetement.ProprietaireId = UserManager.GetUserId(User);

                // requires using ContactManager.Authorization;
                var isAuthorized = await AuthorizationService.AuthorizeAsync(
                    User, vetement,
                    VetementOperations.Create);

                if (!isAuthorized.Succeeded)
                {
                    return(Forbid());
                }

                Contexte.Add(vetement);
                await Contexte.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            return(View(vetement));
        }