Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 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);
 }