public ActionResult Create([Bind(Include = "Id,Nome")] Comarca comarca) { if (ModelState.IsValid) { db.Comarcas.Add(comarca); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(comarca)); }
public ActionResult Create([Bind(Include = "Id,Nome,ComarcaId")] Vara vara) { if (ModelState.IsValid) { db.Varas.Add(vara); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ComarcaId = new SelectList(db.Comarcas, "Id", "Nome", vara.ComarcaId); return(View(vara)); }
public void Adicionar(Pessoa pessoa) { db.Pessoas.Add(pessoa); db.SaveChanges(); }