public virtual FashionPackageViewModel Create(FashionPackage currentContent)
        {
            var defaultPrice    = _pricingService.GetDefaultPrice(currentContent.Code);
            var discountedPrice = defaultPrice != null
                ? _pricingService.GetDiscountPrice(defaultPrice.CatalogKey.CatalogEntryCode).UnitPrice
                : (Money?)null;

            return(new FashionPackageViewModel
            {
                Package = currentContent,
                ListingPrice = defaultPrice?.UnitPrice ?? _pricingService.GetMoney(0),
                DiscountedPrice = discountedPrice,
                Images = currentContent.GetAssets <IContentImage>(_contentLoader, _urlResolver),
                IsAvailable = defaultPrice != null,
                Entries = _catalogContentService.GetVariants <FashionVariant>(currentContent).ToList()
            });
        }
Exemple #2
0
        public virtual FashionPackageViewModel Create(FashionPackage currentContent)
        {
            var variants     = GetVariants(currentContent).ToList();
            var market       = _currentMarket.GetCurrentMarket();
            var currency     = _currencyservice.GetCurrentCurrency();
            var defaultPrice = GetDefaultPrice(currentContent.Code, market, currency);
            var viewModel    = new FashionPackageViewModel
            {
                Package         = currentContent,
                ListingPrice    = defaultPrice != null ? defaultPrice.UnitPrice : new Money(0, currency),
                DiscountedPrice = GetDiscountPrice(defaultPrice, market, currency),
                Images          = currentContent.GetAssets <IContentImage>(_contentLoader, _urlResolver),
                IsAvailable     = defaultPrice != null,
                Entries         = variants
            };

            return(viewModel);
        }