public async Task <IActionResult> Edit(int id, [Bind("IDEditorial,Nombre,Mail")] Editorial editorial)
        {
            if (id != editorial.IDEditorial)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(editorial);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EditorialExists(editorial.IDEditorial))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(editorial));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("IDLibro,Titulo,IDAutor,IDGenero,IDEditorial")] Libro libro)
        {
            if (id != libro.IDLibro)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(libro);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LibroExists(libro.IDLibro))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IDAutor"]     = new SelectList(_context.Autores, "IDAutor", "IDAutor", libro.IDAutor);
            ViewData["IDEditorial"] = new SelectList(_context.Editoriales, "IDEditorial", "IDEditorial", libro.IDEditorial);
            ViewData["IDGenero"]    = new SelectList(_context.Generos, "IDGenero", "IDGenero", libro.IDGenero);
            return(View(libro));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IDGenero,NombreGenero")] Genero genero)
        {
            if (id != genero.IDGenero)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(genero);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GeneroExists(genero.IDGenero))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(genero));
        }
Пример #4
0
        public async Task <IActionResult> Edit(int id, [Bind("IDUsuario,Nombre,Apellido,DNI,FechaNacimiento,Contraseña")] Usuario usuario)
        {
            if (id != usuario.IDUsuario)
            {
                return(NotFound());
            }

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