public async Task <JsonResult> Delete(string id) { var isDelete = await ProductBLL.Delete(id); if (isDelete) { return(Json(new { success = "true" })); } return(Json(new { success = "false" })); }
private void Del() { string id = Request.QueryString["productId"]; if (!string.IsNullOrEmpty(id)) { int productId = 0; int.TryParse(id, out productId); productBLL.Delete(productId); Response.Write("{success: true}"); } else { Response.Write("{success: false}"); } Response.End(); }
protected void rpt_ItemCommand(object source, RepeaterCommandEventArgs e) { int productId = int.Parse(e.CommandArgument.ToString()); IProductBLL productBLL = (IProductBLL)SpringContext.Context.CreateSecurityProxyInstance("ProductBLL"); switch (e.CommandName.ToLower()) { case "delete": productBLL.Delete(productId); Response.Redirect("ProductList.aspx", true); break; case "putcar":; Product product = productBLL.Select(productId); OrderProduct orderProduct = new OrderProduct(); orderProduct.Num = 1; orderProduct.ProductID = productId; orderProduct.ProductName = product.ProductName; IUserBLL userBLL = (IUserBLL)SpringContext.Context.CreateSecurityProxyInstance("UserBLL"); ICustomBLL customBLL = (ICustomBLL)SpringContext.Context.CreateSecurityProxyInstance("CustomBLL"); if (customBLL.Select(userBLL.UserID).IsMember) { orderProduct.Price = product.MemberPrice; } else { orderProduct.Price = product.NormalPrice; } IShopCarBLL shopCarBLL = (IShopCarBLL)SpringContext.Context.CreateSecurityProxyInstance("ShopCarBLL"); shopCarBLL.Add(orderProduct); Response.Redirect("ShopCar.aspx", true); break; default: break; } }