Ejemplo n.º 1
0
        private SheetMusicProductModel Create(SheetMusicProduct product)
        {
            var model = new SheetMusicProductModel
            {
                Product = product,
                Url     = this._urlResolver.GetUrl(product.ContentLink),
            };

            return(model);
        }
Ejemplo n.º 2
0
        public IEnumerable <SheetMusicVariantModel> GetChildren(SheetMusicProduct parentProduct)
        {
            var variants = this._contentLoader
                           .GetItems(parentProduct.GetVariants(this._relationRepository), parentProduct.Language)
                           .Cast <SheetMusicVariant>()
                           .ToList();

            var models = variants
                         .Select(this.Create)
                         .ToList();

            return(models);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 public SheetMusicProductModel Get(SheetMusicProduct product)
 {
     return(this.Create(product));
 }