Пример #1
0
        private void UpdateKeywords(Product[] products, ProductType[] prodTypes, BuildingUpgrade[] buildingUpgrades, BuildingUpgrade bu)
        {
            foreach (var prod in products)
            {
                var pt = prodTypes.FirstOrDefault(x => x.Id == prod.ProductTypeId);
                if (pt != null)
                {

                    prod.Keywords.Add(pt.ManufacturerType.Name);
                }
                if (buildingUpgrades != null)
                foreach (var ug in buildingUpgrades.Where(x => x.Products.Any(y => y.ProductTypeId == prod.ProductTypeId)))
                {
                    prod.Keywords.Add(ug.Name);
                }
                if (bu != null)
                    prod.Keywords.Add(bu.Name);
            }
        }
Пример #2
0
 private static void UpdateProductStorageQuantity(IEnumerable<Product> collection, Product storageProduct)
 {
     if (collection == null)
         return;
     var updProd = collection.FirstOrDefault(x => x.ProductTypeId == storageProduct.ProductTypeId);
     if (updProd != null)
         updProd.StorageQuantity = storageProduct.Quantity;
 }