コード例 #1
0
        public ActionResult Delete(int pcateNum)
        {
            ProductCategory productCategory = service.GetByWhere(item => item.Id == pcateNum).SingleOrDefault();

            productCategory.IsDelete = 1;
            bool val = service.Update(productCategory);

            if (val)
            {
                return(Json("删除成功", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("删除失败", JsonRequestBehavior.AllowGet));
            }
        }
        protected void updateButton_Click(object sender, EventArgs e)
        {
            if (categoryNameTextBox.Text == "")
            {
                outputLabel.Text = "Please fill up the text box.";
            }
            else
            {
                ProductCategory category = new ProductCategory();
                category.Id           = Convert.ToInt32(idHiddenField.Value);
                category.CategoryName = categoryNameTextBox.Text;


                outputLabel.Text = categoryManager.Update(category);
                Response.Redirect("ShowAllProductCategoryEntryInfoUI.aspx");
            }
        }