Esempio n. 1
0
        private IEnumerable<ProductUpdateViewModel> ProductUpdateAdaptor(IEnumerable<ProductUpdate> productUpdates)
        {
            if (_vendorProvider == null)
                _vendorProvider = new VendorProvider();
            if (_productProvider == null)
                _productProvider = new ProductProvider();

            var updatedProducts = new List<ProductUpdateViewModel>();

            Product product;
            foreach (var update in productUpdates)
            {
                product = _productProvider.GetProduct(update.VendorCode, update.ProductId);
                updatedProducts.Add(new ProductUpdateViewModel
                {
                    ProductDescription = product.Description,
                    ProductName = product.Name,
                    ProductPrice = product.Price,
                    VendorName = _cachedVendors.First(vendor => vendor.Code == product.VendorCode).Name
                });
            }

            return updatedProducts;
        }
Esempio n. 2
0
 private void Initialize()
 {
     _vendorProvider = new VendorProvider();
     _productProvider = new ProductProvider();
     _productUpdateProvider = new ProductUpdateProvider();
 }