public JsonResult DeleteProduct(int id) { var shppingCart = _shoppingCartItemService.GetById(id); _shoppingCartItemService.Delete(shppingCart); var jsonResult = Json(new { success = true }, JsonRequestBehavior.AllowGet); return(jsonResult); }
public HttpStatusCode Delete(int id) { try { _shoppingCartItemService.Delete(id); return(HttpStatusCode.OK); } catch (Exception ex) { return(HttpStatusCode.InternalServerError); } }
public async Task ClearCart(long cartId) { try { var cartItems = await _shoppingCartItemService.GetList(x => x.ShoppingCart_Id == cartId); _shoppingCartItemService.Delete(cartItems); } catch (Exception) { throw; } }
public async Task Delete(ShoppingCartItemDto dto) { try { var cartItem = await _shoppingCartItemService.Get(x => x.Product_Id == dto.productId && x.ShoppingCart_Id == dto.cartId); if (cartItem == null) { throw new Exception("can not find"); } _shoppingCartItemService.Delete(cartItem); } catch (Exception) { throw; } }