public static CartItemModel Create( DealModel deal, DealOptionModel dealOption, List<DealAttributeModel> selectedAttributeValues) { var cartItemModel = new CartItemModel { Deal = deal, DealOption = dealOption, Quantity = 1 }; foreach (var attr in selectedAttributeValues) { cartItemModel.attributeValues.Add(attr); } cartItemModel.Key = Guid.NewGuid().ToString(); return cartItemModel; }
public static CartItemModel CreateCartItem( DealModel deal = null, DealOptionModel dealOption = null, List<DealAttributeModel> dealAttributes = null) { if (deal == null && dealOption == null) { deal = CreateCompleteDeal(); dealOption = deal.Options.First(); } if (dealAttributes == null) { dealAttributes = new List<DealAttributeModel>(); foreach (var attr in dealOption.Attributes) { dealAttributes.Add(attr); } } return CartItemModel.Create(deal, dealOption, dealAttributes); }
public void AddOption(DealOptionModel option) { options.Add(option); }