Esempio n. 1
0
        public IActionResult Edit(int id, Telefono telefono)
        {
            if (id != telefono.TelefonoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(telefono);
                    _context.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TelefonoExists(telefono.TelefonoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PersonaID"] = new SelectList(_context.Personas, "PersonaId", "Nombre", telefono.PersonaID);
            return(View(telefono));
        }
        public IActionResult Edit(int id, [Bind("PersonaId,Nombre,FechaNacimiento,CreditoMaximo")] Persona persona)
        {
            if (id != persona.PersonaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(persona);
                    _context.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PersonaExists(persona.PersonaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(persona));
        }