Пример #1
0
        public OperationResult Create(CreateInventory command)
        {
            var operationResult = new OperationResult();

            if (_inventoryRepo.Exists(c => c.ProductId == command.ProductId))
            {
                return(operationResult.Failed(ApplicationMessage.duplicated));
            }

            var inventory = new Inventory(command.ProductId, command.UnitPrice);

            _inventoryRepo.Create(inventory);
            _inventoryRepo.Save();
            return(operationResult.Succeeded());
        }