예제 #1
0
        public ActionResult Create(Link link)
        {
            link.SiteId = MvcApplication.GetSiteId();
            if (ModelState.IsValid)
            {
                db.Link.Add(link);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.SiteId = new SelectList(db.Site, "Id", "Nome", link.SiteId);
            return View(link);
        }
예제 #2
0
 public ActionResult Edit(Link link)
 {
     if (ModelState.IsValid)
     {
         db.Entry(link).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.SiteId = new SelectList(db.Site, "Id", "Nome", link.SiteId);
     return View(link);
 }