protected void cartViewRepeater_ItemCommand(object source, RepeaterCommandEventArgs e) { BetaDB db = new BetaDB(); HiddenField hdnID = e.Item.FindControl("ProHdn") as HiddenField; int id = Convert.ToInt32(hdnID.Value); Label productSize = e.Item.FindControl("lblProductSize") as Label; var size = productSize.Text; DropDownList dl = e.Item.FindControl("Quantity") as DropDownList; int qty = Convert.ToInt32(dl.SelectedItem.Text); if (e.CommandName == "remove") { if (carthandler.GetCount() != 0) { CartItem ci = new CartItem { Id = id, Quantity = qty, Size = size }; carthandler.RemoveFromCart(ci); //cookiehandler.DeleteCookie("Cart", Id, size); //cookiehandler.ch.products = cookiehandler.GetCookie("Cart"); //cookiehandler.AddCookie("Cart", cookiehandler.ch.products); } } CartDetails(); Response.Redirect(Request.Url.ToString()); }
public IActionResult RemoveFromCart(int userId, int productId) { cartHandler.RemoveFromCart(userId, productId); return(RedirectToAction("Index", "Cart", new { userId })); }