Skip to content

Instantly share code, notes, and snippets.

Avatar

Marlon Tiedt TiedtTech

View GitHub Profile
View ActionHttpPost.cs
public ActionResult Cadastro(Pessoa model)
{
using (var db = new Conexao())
{
if (model.PessoaID == 0)
{
db.Pessoa.Add(model);
}
else
{
View View.cshtml
@model site.Models.Pessoa
@{
var novoRegistro = true;
if (Model != null && Model.PessoaID != 0)
{
novoRegistro = false;
}
}
View ActionHttpGet.cs
public ActionResult Cadastro(int? id)
{
if (id != null)
{
using (var db = new Conexao())
{
var registro = db.Pessoa.Find(id);
return View(registro);
}
}
You can’t perform that action at this time.