public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Idade")] 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("TarefasId,Nome,Descricao,Inicio,Fim,Importancia")] Tarefas tarefas) { if (id != tarefas.TarefasId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tarefas); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TarefasExists(tarefas.TarefasId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tarefas)); }