Beispiel #1
0
        public JsonResult DeletePDetail(int id)
        {
            var status = productDetailService.Delete(id);

            productDetailService.Save();
            return(Json(status, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public bool Delete(int id)
        {
            var entity = _ProductDetailService.GetProductDetailById(id);

            if (entity == null)
            {
                return(false);
            }
            if (_ProductDetailService.Delete(entity))
            {
                return(true);
            }
            return(false);
        }
Beispiel #3
0
        public HttpResponseMessage Delete(HttpRequestMessage request, int id)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (ModelState.IsValid)
                {
                    request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    _productDetailService.Delete(id);
                    _productDetailService.SaveChanges();

                    response = request.CreateResponse(HttpStatusCode.OK);
                }
                return response;
            }));
        }
Beispiel #4
0
        /// <summary>
        /// 删除商品
        /// </summary>
        /// <param name="id">商品Id</param>
        /// <returns>提示信息</returns>
        public HttpResponseMessage Delete(int id)
        {
            var productDetail = _productDetailService.GetProductDetailById(id);

            if (productDetail == null)
            {
                return(PageHelper.toJson(PageHelper.ReturnValue(false, "商品详细不存在")));
            }
            if (_productDetailService.Delete(productDetail))
            {
                var entity = _productService.GetProductById(id);
                if (entity == null)
                {
                    return(PageHelper.toJson(PageHelper.ReturnValue(false, "数据不存在")));
                }
                if (_productService.Delete(entity))
                {
                    return(PageHelper.toJson(PageHelper.ReturnValue(true, "数据删除成功")));
                }
            }
            return(PageHelper.toJson(PageHelper.ReturnValue(true, "数据删除失败")));
        }
 public ActionResult Delete(int id)
 {
     _productDetailService.Delete(id);
     return(RedirectToAction("Index"));
 }