Skip to content

Instantly share code, notes, and snippets.

@TiedtTech
Created October 22, 2020 02:34
Show Gist options
  • Save TiedtTech/ae4dc44c9ba4b81cd6d850bf67daaf62 to your computer and use it in GitHub Desktop.
Save TiedtTech/ae4dc44c9ba4b81cd6d850bf67daaf62 to your computer and use it in GitHub Desktop.
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