コード例 #1
0
        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));
        }