/// <summary> /// Initializes a new instance of the <see cref="OfferDraftItem"/> class. /// </summary> /// <param name="product"><see cref="Product"/> on offer.</param> /// <param name="quantity">Quantity of products on offer.</param> public OfferDraftItem(Product product, int quantity) { if (product == null) throw new ArgumentNullException("product"); if (quantity < 1) throw new ArgumentOutOfRangeException("quantity", quantity, "Quantity should be positive."); _product = product; _quantity = quantity; }
/// <summary> /// Initializes a new instance of the <see cref="OfferItem"/> class for the specified product. /// </summary> /// <param name="draftItem"><see cref="OfferDraftItem"/> from which the offer item is created.</param> public OfferItem(OfferDraftItem draftItem) { if (draftItem == null) throw new ArgumentNullException("draftItem"); _product = draftItem.Product; _quantity = draftItem.Quantity; _discount = draftItem.Discount; _productPrice = _product.Price; _discountAmount = draftItem.DiscountAmount; _itemTotal = draftItem.ItemTotal; _itemSubtotal = draftItem.ItemSubtotal; }