Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("IdUtilisateur,Nom,Prenom,Description,Email,MotPass,Civilité,Telephone,IdProfilUtilisateur,IdAdresse")] Utilisateur utilisateur)
        {
            if (id != utilisateur.IdUtilisateur)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(utilisateur);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UtilisateurExists(utilisateur.IdUtilisateur))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdAdresse"]           = new SelectList(_context.Adresse, "IdAdresse", "IdAdresse", utilisateur.IdAdresse);
            ViewData["IdProfilUtilisateur"] = new SelectList(_context.ProfilUtilisateur, "IdProfilUtilisateur", "TypeProfil", utilisateur.IdProfilUtilisateur);
            return(View(utilisateur));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("IdPhoto,IdFormat,IdTheme,TitrePhoto,DescriptionPhoto,PrixPhoto,LargeurPhoto,HauteurPhoto,IdUtilisateur,IdOrientation,DateDepose")] Photo photo)
        {
            if (id != photo.IdPhoto)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(photo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PhotoExists(photo.IdPhoto))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdOrientation"] = new SelectList(_context.Orientation, "IdOrientation", "NomOrientation", photo.IdOrientation);
            ViewData["IdUtilisateur"] = new SelectList(_context.Utilisateur, "IdUtilisateur", "IdUtilisateur", photo.IdUtilisateur);
            return(View(photo));
        }