Exemplo n.º 1
0
        public ActionResult OnDelete(int id)
        {
            var result = ProductTypeService.Delete(id);

            SetFlashMessage(result == Result.Ok ? "Xóa Loại sản phẩm thành công." :
                            "Loại sản phẩm không tồn tại trên hệ thống.");
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public ActionResult Delete(ProductTypeModel[] model)
        {
            foreach (var item in model)
            {
                var productType = _productTypeService.Find(item.Id);
                _productTypeService.Delete(productType);
            }

            return(AjaxForm().ReloadPage());
        }
Exemplo n.º 3
0
        public IActionResult Delete(string id)
        {
            if (!productTypeService.Delete(id))
            {
                Response.StatusCode = 404;
                return(Json(new JsonMessage("Такой категории не существует", "")));
            }

            return(Json(new JsonMessage("Категория была успешно удалена", "")));
        }
        public ActionResult Delete(string id)
        {
            var productType = service.Get(id);

            if (productType is null)
            {
                return(NotFound());
            }

            service.Delete(productType);
            return(Ok());
        }
Exemplo n.º 5
0
        /// <summary>
        /// 控件行命令事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void repInfo_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName.Equals("del"))
            {
                ProductTypeService.Delete(id);
                sp.InitBindData(repInfo, this.pager1, "ProductType", "id", sear());
            }
            if (e.CommandName.Equals("mod"))
            {
                ProductType item = ProductTypeService.GetModel(id);
                if (item != null)
                {
                    this.txtTypeName.Text = item.typeName;
                    ddlOne.SelectedValue  = item.oneId.ToString();
                    ddlTwo.Items.Clear();
                    DataSet ds = ProductTypeService.GetList("parentId = " + ddlOne.SelectedValue);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        ddlTwo.DataSource     = ds;
                        ddlTwo.DataTextField  = "typeName";
                        ddlTwo.DataValueField = "id";
                        ddlTwo.DataBind();
                    }
                    ddlTwo.Items.Insert(0, new ListItem("请选择", "0"));
                    ddlTwo.SelectedValue = item.twoId.ToString();

                    ddlThree.Items.Clear();
                    ds = ProductTypeService.GetList("parentId = " + ddlTwo.SelectedValue);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        ddlThree.DataSource     = ds;
                        ddlThree.DataTextField  = "typeName";
                        ddlThree.DataValueField = "id";
                        ddlThree.DataBind();
                    }
                    ddlThree.Items.Insert(0, new ListItem("请选择", "0"));
                    ddlThree.SelectedValue = item.threeId.ToString();
                    if (item.imgUrl != "")
                    {
                        lblUrl.Text     = item.imgUrl;
                        Button6.Visible = true;
                    }
                    lblUrl2.Text     = item.diaryImg;
                    ViewState["mod"] = id;
                    lblUrl3.Text     = item.remark;
                    txtNameEn.Text   = item.typeDesc;
                    ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "overKeyWordDiv();", true);
                }
            }
        }
        public ActionResult Delete(string id)
        {
            try {
                var productType = service.Get(id);

                Expression<Func<Product, bool>> filter = x => x.ProductType.Id.Equals(id);
                
                service.Delete(productType);
                return Ok(new { Success = true, Message = "", data = id });
            } catch {
                return Ok(new { Success = false, Message = "", data = id });
            }
        }
Exemplo n.º 7
0
        public virtual IHttpActionResult Delete([FromUri] ProductTypeDeleteRequest request)
        {
            var result = _productTypeService.Delete(a => a.Id == request.Id);

            if (result > 0)
            {
                return(Succeed(result, "删除成功"));
            }
            else
            {
                return(Fail("删除失败"));
            }
        }
Exemplo n.º 8
0
 public ActionResult ConfirmDeleteProductType(string id)
 {
     if (Session["uname"] != null)
     {
         int i = productTypeService.Delete(id);
         if (i != 0)
         {
             TempData["TypeMessage"] = "Successfully Deleted";
         }
         return(RedirectToAction("AllTypes", "Product"));
     }
     return(RedirectToAction("Index", "Home"));
 }
Exemplo n.º 9
0
        public JsonResult Delete(ProductType oProductType)
        {
            GlobalSession.SessionIsAlive(Session, Response);

            ProductType _oProductType = new ProductType();

            if (oProductType.ProductTypeID > 0)
            {
                _oProductType.ErrorMessage = _oProductTypeService.Delete(oProductType, (int)Session[GlobalSession.UserID]);
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string sjson = serializer.Serialize(_oProductType);

            return(Json(sjson, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 10
0
        /// <summary>
        /// Delete
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int          productTypeId   = Convert.ToInt32(dgvProductTypes.CurrentRow.Cells["ProductTypeId"].Value);
            string       productTypeName = dgvProductTypes.CurrentRow.Cells["ProductTypeName"].Value.ToString();
            DialogResult dialogResult    = MessageBox.Show(btnDelete, "Are you really want to Delete productTypeName:" + productTypeName, "Confirmation", MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.OK)
            {
                var productType = new ProductType()
                {
                    ProductTypeId = productTypeId
                };
                productTypeService.Delete(productType);
                BindData();
                ResetUIInputtdData();
            }
        }