public ILineItem LineItemByCode(string code) { var lineItem = LineItems.FirstOrDefault(x => x.Code.Equals(code, StringComparison.OrdinalIgnoreCase)); return(lineItem); }
protected virtual async Task <CartAggregate> InnerAddLineItemAsync(LineItem lineItem, CartProduct product = null, IList <DynamicPropertyValue> dynamicProperties = null) { var existingLineItem = LineItems.FirstOrDefault(li => li.ProductId == lineItem.ProductId); if (existingLineItem != null) { await InnerChangeItemQuantityAsync(existingLineItem, existingLineItem.Quantity + Math.Max(1, lineItem.Quantity), product); existingLineItem.FulfillmentCenterId = lineItem.FulfillmentCenterId; existingLineItem.FulfillmentCenterName = lineItem.FulfillmentCenterName; lineItem = existingLineItem; } else { lineItem.Id = null; Cart.Items.Add(lineItem); } if (dynamicProperties != null) { await UpdateCartItemDynamicProperties(lineItem, dynamicProperties); } return(this); }
public void RemoveProduct(int productId) { var item = LineItems.FirstOrDefault(x => x.ProductId == productId); if (item != null) { LineItems.Remove(item); } }
public void Remove(string lineItemId) { var lineItem = LineItems.FirstOrDefault(li => li.Id == lineItemId); if (lineItem != null) { LineItems.Remove(lineItem); } }
public void Add(LineItem lineItem) { var existingLineItem = LineItems.FirstOrDefault(li => li.ProductId == lineItem.ProductId); if (existingLineItem != null) { existingLineItem.Quantity += lineItem.Quantity; } else { LineItems.Add(lineItem); } }
public LineItem GetLockInSaleItem(LineItem lockInAdjustment) { var lockInLineItem = LineItems.FirstOrDefault( lineItem => lineItem.TradeMoney.Currency == lockInAdjustment.TradeMoney.Currency && lineItem.LineItemType != ItemType.LockInSaleAdjustment); if (lockInLineItem == null) { throw new ArgumentException(string.Format( "Unable to retrieve lock-in sale item for lock-in adjustment LineItemId: {0}", lockInAdjustment.Id)); } return(lockInLineItem); }
public void AddProduct(int productId, int qty, double price) { var item = LineItems.FirstOrDefault(x => x.ProductId == productId); if (item != null) { item.Quantity += qty; } else { LineItems.Add(new OrderLineItem { ProductId = productId, Quantity = qty, Price = price, OrderId = OrderId }); } }
public void RemoveProduct(int productId) { var item = LineItems.FirstOrDefault(x => x.ProductId == productId); if (item != null) { LineItems.Remove(item); } /* veya */ /*foreach (var item in LineItems) * { * if (item.ProductId == productId) * { * LineItems.Remove(item); * break; * } * }*/ }
public FinAnalyzerLineItem LineItem(string inventoryID) { return(LineItems.FirstOrDefault(x => x.InventoryID == inventoryID)); }