public ActionResult Create(Secao secao) { if (ModelState.IsValid) { db.Secao.Add(secao); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.SiteId = new SelectList(db.Site, "Id", "Nome", secao.SiteId); return View(secao); }
public ActionResult Edit(Secao secao) { if (ModelState.IsValid) { db.Entry(secao).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.SiteId = new SelectList(db.Site, "Id", "Nome", secao.SiteId); return View(secao); }