public IHttpActionResult EditCategory(ProductCategory productCategory)
        {
            var productCategoryService = new ProductCategoryService();
            var editCategory           = productCategoryService.EditCategory(productCategory);
            var result = new
            {
                Count = editCategory?"修改成功":"修改失败"
            };

            return(Json(result));
        }
        public override bool Init(Client client)
        {
            int productCategoryID;

            if (int.TryParse(BaseFuncs.GetAdditionalURLArray(client.URL, this.URL)[0], out productCategoryID))
            {
                ProductCategory productCategory = productCategoryService.GetByID(productCategoryID);
                if (productCategory != null)
                {
                    Hashtable data = new Hashtable();

                    if (client.PostParam("EditProductCategory") != null)
                    {
                        if (client.PostParam("name") != null)
                        {
                            productCategory.Name        = client.PostParam("name");
                            productCategory.Image       = client.PostParam("image");
                            productCategory.Description = client.PostParam("desc");
                            productCategoryService.EditCategory(productCategory);

                            client.Redirect("/product.category/#pr_" + productCategory.ID);
                            Logger.ConsoleLog("Edited product category: " + productCategory.Name + " (ID: " + productCategory.ID + ")", ConsoleColor.Yellow);

                            return(false);
                        }
                    }
                    data.Add("ProductCategory", productCategory);
                    client.HttpSend(TemplateActivator.Activate(this, client, data));
                    return(true);
                }
            }


            BaseFuncs.Show404(client);
            return(false);
        }