public ProductBundleItemEditAdminViewModel(ProductBundleItem productBundleItem, UserProfile userProfile) { if (userProfile == null) { throw new ArgumentNullException("userProfile"); } if (productBundleItem == null) { throw new ArgumentNullException("productBundleItem"); } LoadValues(userProfile, productBundleItem); }
protected void LoadValues(UserProfile userProfile, ProductBundleItem productBundleItem) { if (productBundleItem == null) { return; } this.IsActiveDirect = productBundleItem.IsActiveDirect(); this.IsActiveBubble = productBundleItem.IsActiveBubble(); this.ProductBundleItemId = productBundleItem.ProductBundleItemId; this.ProductBundle = productBundleItem.ProductBundle; this.ProductBundleItem = productBundleItem; this.Order = productBundleItem.Order; this.Quantity = productBundleItem.Quantity; this.ProductVariantInfo = productBundleItem.ProductVariantInfo; this.BaseUnitPrice = productBundleItem.BaseUnitPrice; this.BaseListPrice = productBundleItem.BaseListPrice; this.IsPending = productBundleItem.IsPending; this.EndDateTimeUtc = productBundleItem.EndDateTimeUtc; this.StartDateTimeUtc = productBundleItem.StartDateTimeUtc; }
/// <summary> /// Renders bundle item list partial view for the current bundle /// </summary> /// <param name="htmlHelper"></param> public static void RenderCatalogBundleItemForListPartial(this HtmlHelper<CatalogViewModel> htmlHelper, ProductBundleItem item) { CatalogViewModel viewModel = htmlHelper.ViewData.Model; ProductBundleItem oldValueProductBundleItem = htmlHelper.ViewData.Model.CurrentProductBundleItemOrNull; Product oldValueProduct = htmlHelper.ViewData.Model.CurrentProductOrNull; ViewDataDictionary<CatalogViewModel> newViewData = new ViewDataDictionary<CatalogViewModel>(htmlHelper.ViewData); newViewData.Model.CurrentProductBundleItemOrNull = item; newViewData.Model.CurrentProductOrNull = item.Product; string view = "_BundleItemForList_Partial"; htmlHelper.RenderCatalogPartialHelper(view, newViewData); htmlHelper.ViewData.Model.CurrentProductBundleItemOrNull = oldValueProductBundleItem; htmlHelper.ViewData.Model.CurrentProductOrNull = oldValueProduct; }