public ProductBase(int id, string title, decimal price, CategoryBase category)
        {
            if (id <= 0 || price < 0)
            {
                throw new ArgumentException();
            }

            Id       = id;
            Price    = price;
            Title    = title.ThrowIfNull(nameof(title));
            Category = category.ThrowIfNull(nameof(category));
        }
Example #2
0
        public CampaignBase(int id, string title, decimal discount, CategoryBase category)
        {
            if (id <= 0 || discount < 0)
            {
                throw new ArgumentException();
            }

            Id       = id;
            Discount = discount;
            Title    = title.ThrowIfNull(nameof(title));
            Category = category.ThrowIfNull(nameof(category));
        }