} //End method


        /// <summary> This method returns the SKU object that matches the one passed into the function. </summary>
        /// <param name="SKU"> A Container SKU object. </param>
        /// <returns> The matched object if found, otherwise adds it to the DB and return the object. </returns>
        public void GetSKU(Cont.SKU SKU)
        {
            var info = SKUs.FirstOrDefault(x => x.Equals(SKU));
            if (info == null)
            {
                SKU.ID = Handler.SKU.Add(SKU);
                SKUs.Add(SKU);
            }
            else
            {
                SKU.ID = info.ID;
            }
        } //End method
Beispiel #2
0
        public void Scan(Item item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            SKUs.Add(item);

            var applied = Offers
                          .Where(r => r.SKU == item.SKU)
                          .Where(r => r.Apply(item, SKUs))
                          .Select(r => new OfferResult(r.SKU, r.Name, r.Quantity, r.OfferPrice));

            AppliedOffers.AddRange(applied);
        }