예제 #1
0
        public void AddSupplier(string productSku, string supplierName, IEnumerable <string> productBarcodes)
        {
            _inventoryManager.Initialize();
            var tenantId      = _tenantRepository.Acquiree.Id;
            var newSupplierId =
                _inventoryManager.GetAllSuppliers(tenantId).Count() + 1; // Simple id generator logic
            var supplier = _inventoryManager.AddSupplier(tenantId, newSupplierId, supplierName);

            supplier?.AddBarcodes(productBarcodes);
            var product = _inventoryManager.GetProductBySku(tenantId, productSku);

            product?.AddSupplier(supplier);
            _inventoryManager.SaveProducts(tenantId);
            _inventoryManager.SaveSuppliers(tenantId);
            _inventoryManager.SaveSupplierProductBarcodes(tenantId);
        }