public ActionResult Edit(category category)
 {
     if (ModelState.IsValid)
     {
         db.categories.Attach(category);
         db.ObjectStateManager.ChangeObjectState(category, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(category);
 }
        public ActionResult Create(category category)
        {
            if (ModelState.IsValid)
            {
                db.categories.AddObject(category);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(category);
        }
 /// <summary>
 /// Create a new category object.
 /// </summary>
 /// <param name="cid">Initial value of the Cid property.</param>
 public static category Createcategory(global::System.Int32 cid)
 {
     category category = new category();
     category.Cid = cid;
     return category;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTocategories(category category)
 {
     base.AddObject("categories", category);
 }