Пример #1
0
        public static IEnumerable <DiscountItem> RemoveDiscountItem(this IEnumerable <DiscountItem> src, DiscountItem item)
        {
            var e = src.Where(x => x.Code == item.Code);

            if (e.Any())
            {
                var x     = e.FirstOrDefault();
                var items = src.ToList();
                items.Remove(x);
                return(items);
            }
            else
            {
                return(src);
            }
        }
Пример #2
0
        public static IEnumerable <DiscountItem> ReplaceDiscountItem(this IEnumerable <DiscountItem> src, DiscountItem item)
        {
            foreach (var e in src)
            {
                if (e.Code == item.Code)
                {
                    e.Total    = item.Total;
                    e.Sku      = item.Sku;
                    e.RuleType = item.RuleType;
                }
            }

            return(src);
        }