示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,TypeVaccin,Marque,NumLot,Date,DateRappel")] Vaccin vaccin)
        {
            if (id != vaccin.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vaccin);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VaccinExists(vaccin.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vaccin));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nom,Prenom,Sexe,DateNaissance,Type")] Vaccinator.Models.Personne personne)
        {
            if (id != personne.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(personne);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategorieExists(personne.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(personne));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nom,AnneeDeNaissance")] Chaton chaton)
        {
            if (id != chaton.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(chaton);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ChatonExists(chaton.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(chaton));
        }
示例#4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Libelle,Description")] Categorie categorie)
        {
            if (id != categorie.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(categorie);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategorieExists(categorie.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(categorie));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,firstName,lastName,birthDate,gender,category")] User user)
        {
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Lot,Marque,DatePremier,DateRappel")] Injection injection)
        {
            if (id != injection.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(injection);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InjectionExists(injection.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(injection));
        }
示例#7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,name,periodicity")] Vaccine vaccine)
        {
            if (id != vaccine.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vaccine);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VaccineExists(vaccine.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vaccine));
        }
示例#8
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Type,Marque,NumeroLot,Date,DateRappel,Vaccin,Personne")] Vaccinator.Models.Injection injection)
        {
            if (id != injection.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(injection);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategorieExists(injection.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["listeDesVaccins"]   = new SelectList(_context.Vaccin, "Id", "Nom");
            ViewData["listeDesPersonnes"] = new SelectList(_context.Personne, "Id", "Nom");
            return(View(injection));
        }
示例#9
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Marque,Lot,Date,DateRappel")] Injection injection, int Personne, int Vaccin)
        {
            if (id != injection.Id)
            {
                return(NotFound());
            }

            var personne = await _context.Personnes.FindAsync(Personne);

            injection.Personne = personne;

            var vaccin = await _context.Vaccins.FindAsync(Vaccin);

            injection.Vaccin = vaccin;

            ModelState.Clear();
            TryValidateModel(injection);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(injection);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InjectionExists(injection.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(injection));
        }