public async Task <IActionResult> Edit(int id, [Bind("Id,Nome_Sobrenome,CPF,RG,Data_Nascimento")] CadastroPessoal cadastroPessoal) { if (id != cadastroPessoal.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cadastroPessoal); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CadastroPessoalExists(cadastroPessoal.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(cadastroPessoal)); }
public async Task <IActionResult> Create([Bind("Id,Nome_Sobrenome,CPF,RG,Data_Nascimento")] CadastroPessoal cadastroPessoal) { if (ModelState.IsValid) { _context.Add(cadastroPessoal); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(cadastroPessoal)); }