Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("IdListe,TitreListe")] ListeDeVoyage listeDeVoyage)
        {
            if (id != listeDeVoyage.IdListe)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(listeDeVoyage);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ListeDeVoyageExists(listeDeVoyage.IdListe))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(listeDeVoyage));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("IdListe,TitreListe,VilleId,URLBlason,UtilisateurId")] ListeDeVoyage listeDeVoyage)
        {
            if (ModelState.IsValid)
            {
                _context.Add(listeDeVoyage);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["VilleId"] = new SelectList(_context.Villes, "VilleId", "NomVille", listeDeVoyage.VilleId);

            return(View(listeDeVoyage));
        }
 public ListeDeVoyageDTO(ListeDeVoyage liste)
 {
     model = liste;
 }
 // Constructeurs avec et sans paramètre
 public ListeDeVoyageDTO()
 {
     model = new ListeDeVoyage();
 }