public async Task <IActionResult> Edit(int id, [Bind("Id,Titulo,TituloOriginal,Ano,GeneroId")] Filme filme) { if (id != filme.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(filme); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FilmeExists(filme.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["GeneroId"] = new SelectList(_context.Genero, "Id", "Descricao", filme.GeneroId); return(View(filme)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Sobrenome,Nascimento")] Pessoa pessoa) { if (id != pessoa.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pessoa); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PessoaExists(pessoa.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(pessoa)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Descricao")] Genero genero) { if (id != genero.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(genero); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GeneroExists(genero.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(genero)); }