public IHttpActionResult DelProductType(RequestDelProductType request)
        {
            var tokenResult = IdentityValid.ValidateToken(request.Token);

            if (!tokenResult.IsSuccess)
            {
                return(Json(tokenResult));
            }

            var productTypeBll = new ProductTypeBLL();
            var productBll     = new ProductBLL();

            if (productBll.IsExist(o => o.UserName == tokenResult.userName && o.ProductTypeId == request.ProductTypeId))
            {
                return(Json(new ResponseMsg()
                {
                    IsSuccess = false, Msg = "该物品类别下有物品,不可删除!"
                }));
            }
            if (productTypeBll.IsExist(o => o.ParentProductTypeId == request.ProductTypeId))
            {
                return(Json(new ResponseMsg()
                {
                    IsSuccess = false, Msg = "请先删除子类别!"
                }));
            }
            bool isSuccess = productTypeBll.Delete(o => o.UserName == tokenResult.userName && o.ProductTypeId == request.ProductTypeId);

            return(Json(new ResponseMsg()
            {
                IsSuccess = isSuccess
            }));
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult Delete(string id)
        {
            var json = _typeBll.Delete(id);

            return(Json(json, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        public int Delete(ProductType parameter)
        {
            ProductTypeBLL bll = new ProductTypeBLL();

            return(bll.Delete(parameter));
        }