Created
October 22, 2020 02:34
-
-
Save TiedtTech/ae4dc44c9ba4b81cd6d850bf67daaf62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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