public void AddTicketDiscount(DiscountType type, decimal amount, int userId) { var c = Discounts.SingleOrDefault(x => x.DiscountType == (int)type); if (c == null) { c = new Discount { DiscountType = (int)type, Amount = amount }; Discounts.Add(c); } if (amount == 0) { Discounts.Remove(c); } c.UserId = userId; c.Amount = amount; }
/// <summary> /// Unapplies the <paramref name="discount"/> from this product. /// </summary> /// <param name="discount">The discount to remove.</param> public virtual void UnapplyDiscount(Discount discount) { // Attempt to remove the discount from the list. Discounts.Remove(discount); }