Beispiel #1
0
        public SheetMusicViewModel GetViewModel(SheetMusicProduct product)
        {
            var viewModel = new SheetMusicViewModel
            {
                ProductViewModel = new SheetMusicProductViewModel
                {
                    ProductModel   = this._sheetMusicProductRepository.Get(product),
                    MainImageModel = this._imageMediaRepository.GetMainImage(product),
                }
            };

            viewModel.AddToCartQuantities.AddRange(this.GetQuantities());
            viewModel.VariantViewModels.AddRange(this._sheetMusicVariantRepository.GetChildren(product).Select(this.Create).ToList());

            return(viewModel);
        }
Beispiel #2
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);
        }