public ActionResult GetCategoryById(int id) { var repo = new ProductsRepository(); Category c = repo.CategoryById(id); var categoryJson = new { CategoryID = c.CategoryID, CategoryName = c.CategoryName, CategoryDescription = c.CategoryDescription }; return(Json(categoryJson, JsonRequestBehavior.AllowGet)); }