// ---------------------------------------------------------------------------- // sepetten çıkar // ---------------------------------------------------------------------------- public static List <CartProduct> RemoveItem(CartProduct newItem, object value) { List <CartProduct> currentItems = GetAllCartProduct(value); currentItems.Remove(newItem); return(currentItems); }
// ---------------------------------------------------------------------------- // sepete ekle // ---------------------------------------------------------------------------- public static List <CartProduct> AddItem(CartProduct newItem, object value) { List <CartProduct> currentItems = GetAllCartProduct(value); if (currentItems == null) { currentItems.Add(newItem); return(currentItems); } else { foreach (CartProduct item in currentItems) { if (item.ProductID == newItem.ProductID) { item.Quantity += newItem.Quantity; return(currentItems); } } currentItems.Add(newItem); return(currentItems); } }