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));
        }
예제 #3
0
 public void Adicionar(Pessoa pessoa)
 {
     db.Pessoas.Add(pessoa);
     db.SaveChanges();
 }