Example #1
0
        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);
        }
Example #2
0
 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);
 }
Example #3
0
 /// <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;
 }
Example #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Links EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToLinks(Link link)
 {
     base.AddObject("Links", link);
 }