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