private SheetMusicProductModel Create(SheetMusicProduct product) { var model = new SheetMusicProductModel { Product = product, Url = this._urlResolver.GetUrl(product.ContentLink), }; return(model); }
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); }
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); }
public SheetMusicProductModel Get(SheetMusicProduct product) { return(this.Create(product)); }