Exemplo n.º 1
0
        public void RemoveFromCurrentSKUCollection(DataModel.SKU sku)
        {
            var newSKUCollection = CurrentSKUCollection.Copy();
            int matchIndex       = newSKUCollection.SKUs.FindIndex(s => s.Id == sku.Id);

            newSKUCollection.SKUs.RemoveAt(newSKUCollection.SKUs.FindIndex(s => s.Id == sku.Id));
            CurrentSKUCollection = newSKUCollection;
        }
Exemplo n.º 2
0
        public void AddToCurrentSKUCollection(List <DataModel.SKU> skus)
        {
            skus.AddRange(CurrentSKUCollection.SKUs);
            var skusNew = new List <DataModel.SKU>();

            foreach (var sku in skus)
            {
                if (skusNew.FirstOrDefault(f => f.Id == sku.Id) == null)
                {
                    skusNew.Add(sku);
                }
            }

            var newSKUCollection = CurrentSKUCollection.Copy();

            newSKUCollection.SKUs = skusNew;
            CurrentSKUCollection  = newSKUCollection;
        }