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); }
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); }