public ThemeImageViewModel(ThemeImage themeImage, IList<Product> products) { this.Guid = themeImage.Guid; this.Url = themeImage.Url; this.ThumbnailUrl = themeImage.ThumbnailUrl; this.Products = new List<ThemeProductViewModel>(); foreach (var themeProduct in themeImage.Products) { if (products.Any(o => o.Guid == themeProduct.ProductGuid)) { this.Products.Add(new ThemeProductViewModel(themeProduct, products.First(o => o.Guid == themeProduct.ProductGuid))); } } }
public AddProductToThemeImageViewModel(ThemeImage themeImage, IList<Product> products) { this.ThemeProductGuid = Guid.NewGuid(); this.ThemeImageGuid = themeImage.Guid; this.Url = themeImage.Url; this.IsTallImage = themeImage.IsTallImage; this.Products = new List<ThemeProductViewModel>(); foreach (var themeProduct in themeImage.Products) { if (products.Any(o => o.Guid == themeProduct.ProductGuid)) { this.Products.Add(new ThemeProductViewModel(themeProduct, products.First(o => o.Guid == themeProduct.ProductGuid))); } } }