private void Setproduct() { foreach (var item in ProductStatistics.Where(S => ProductName.Exists(p => p.SKU == S.Product.SKU))) { var SKU = item.Product.SKU; item.Product = ProductName.Where(p => p.SKU == SKU).First(); } }
public void CalculateBrandSale() { BrandSaleList.Clear(); foreach (var item in Brands) { for (int i = 0; i < 12; i++) { SalesStatistics s = new SalesStatistics { Product = new Product(), PeriodStart = new DateTime(2017, i + 1, 1) }; s.Product.Brand = item; s.QuantitySold = ProductStatistics.Where(x => x.Product.Brand != null && x.Product.Brand.Name == item.Name && x.PeriodStart.Month == i + 1).Sum(x => x.QuantitySold); BrandSaleList.Add(s); } } }