Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public ActionResult Cadastro(Pessoa model)
{
using (var db = new Conexao())
{
if (model.PessoaID == 0)
{
db.Pessoa.Add(model);
}
else
{
var registro = db.Pessoa.Find(model.PessoaID);
UpdateModel(registro);
}
db.SaveChanges();
return RedirectToAction("Cadastro", controller, new { id = model.PessoaID });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment