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; }
public DiscountViewModel(Discount model) { Model = model; }