Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Nacionalidad,AnyNacimiento")] Autor autor)
        {
            if (id != autor.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(autor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AutorExists(autor.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(autor));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,ReleaseDate,Genre,Price")] Categoria categoria)
        {
            if (id != categoria.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(categoria);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategoriaExists(categoria.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(categoria));
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Titulo,Descripcion,Fecha,CategoriaId")] Comic comic)
        {
            if (id != comic.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(comic);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ComicExists(comic.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoriaId"] = new SelectList(_context.Categoria, "Id", "Id", comic.CategoriaId);
            return(View(comic));
        }