public void AddRange(List <OutInOrderItem> items, OutInOrderType orderType) { foreach (var line in items) { line.OutInOrderId = this.Id; line.SetPlusMinus(orderType); if (this.Items.Exists(n => n.ProductId == line.ProductId)) { var first = this.Items.FirstOrDefault(n => n.ProductId == line.ProductId); first.Quantity += line.Quantity; } else { this.Items.Add(line); } } }
public void SetPlusMinus(OutInOrderType orderType) { this.PlusMinus = (int)orderType.OutInInventory; }