Esempio n. 1
0
        public void Add(InventoryItemViewModel inventoryViewModel)
        {
            InventoryItem inventory = _mapper.Map <InventoryItem>(inventoryViewModel);

            for (int i = 0; i < inventoryViewModel.Quantity; i++)
            {
                _inventoryRepository.Add(new InventoryItem {
                    ProductId             = inventoryViewModel.ProductId,
                    RegistrationDate      = inventoryViewModel.RegistrationDate,
                    InventoryItemStatusId = (int)InventoryItemStatusType.Available
                });
            }

            _inventoryRepository.SaveChanges();
        }