Exemplo n.º 1
0
 private decimal GetPrice(SheetMusicVariant variant)
 {
     return(this._priceService
            .GetDefaultPrice(MarketId.Default, DateTime.Now, new CatalogKey(variant.Code), Currency.USD)
            .UnitPrice
            .Amount);
 }
Exemplo n.º 2
0
 private SheetMusicVariantModel Create(SheetMusicVariant variant)
 {
     return(new SheetMusicVariantModel
     {
         Variant = variant,
         Price = this.GetPrice(variant),
         Url = this._urlResolver.GetUrl(variant.ContentLink)
     });
 }
Exemplo n.º 3
0
        public SheetMusicProductModel GetParent(SheetMusicVariant childVariant)
        {
            var product = childVariant
                          .GetParentProducts()
                          .Select(x => this._contentLoader.Get <SheetMusicProduct>(x))
                          .FirstOrDefault();

            return(this.Create(product));
        }
Exemplo n.º 4
0
        public SheetMusicViewModel GetViewModel(SheetMusicVariant variant)
        {
            var productModel = this._sheetMusicProductRepository.GetParent(variant);

            var viewModel = new SheetMusicViewModel
            {
                ProductViewModel = new SheetMusicProductViewModel
                {
                    ProductModel   = productModel,
                    MainImageModel = this._imageMediaRepository.GetMainImage(productModel.Product)
                },
                SelectedVariantCode = variant.Code,
            };

            viewModel.AddToCartQuantities.AddRange(this.GetQuantities());
            viewModel.AddToCartInputModel.Quantity        = 1;
            viewModel.AddToCartInputModel.Code            = variant.Code;
            viewModel.AddToCartInputModel.CurrentPageLink = this._pageRouteHelper.ContentLink;
            viewModel.VariantViewModels.AddRange(this._sheetMusicVariantRepository.GetChildren(productModel.Product).Select(this.Create));

            return(viewModel);
        }
Exemplo n.º 5
0
 public SheetMusicVariantModel Get(SheetMusicVariant variant)
 {
     return(this.Create(variant));
 }