public ActionResult Edit([Bind(Include = "CategoryID,CategoryName")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(category); }
public void testEdit() { CategoriesController categoriesController = new CategoriesController(); ActionResult edit1 = categoriesController.Edit(5); Category category = new Category(); category.CategoryID = 5; category.CategoryName = "Clothing"; ActionResult edit2 = categoriesController.Edit(category); }