private void RemoveDiscount(string salesName, double qty, double discount) { var td = new TestDiscount(salesName, qty, discount); var d = _cartDiscounts.Find(t => t.Title == td.Title && t.Discount == td.Discount); d.Quantity -= td.Quantity; }
private void AddDiscount(string salesName, double qty, double discount) { var td = new TestDiscount(salesName, qty, discount); for (int i = 0; i < _cartDiscounts.Count; i++) { if (_cartDiscounts[i].Title == td.Title && _cartDiscounts[i].Discount == td.Discount) { _cartDiscounts[i].Quantity += td.Quantity; return; } } _cartDiscounts.Add(td); }