public ActionResult Create(Link link) { if (ModelState.IsValid) { db.Links.AddObject(link); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CatID = new SelectList(db.Categories, "CatID", "CatName", link.CatID); return View(link); }
public ActionResult Edit(Link link) { if (ModelState.IsValid) { db.Links.Attach(link); db.ObjectStateManager.ChangeObjectState(link, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CatID = new SelectList(db.Categories, "CatID", "CatName", link.CatID); return View(link); }
/// <summary> /// Create a new Link object. /// </summary> /// <param name="linkID">Initial value of the LinkID property.</param> /// <param name="linkUrl">Initial value of the LinkUrl property.</param> public static Link CreateLink(global::System.Int64 linkID, global::System.String linkUrl) { Link link = new Link(); link.LinkID = linkID; link.LinkUrl = linkUrl; return link; }
/// <summary> /// Deprecated Method for adding a new object to the Links EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToLinks(Link link) { base.AddObject("Links", link); }