public ActionResult Edit(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } Category category = db.Categories.Find(id); if (category == null) { return HttpNotFound(); } 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); }