Пример #1
0
        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);
        }
Пример #2
0
 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);
 }