Пример #1
0
        public async Task <ProductOption> CreateOption(Guid productId, ProductOption productOption)
        {
            productOption.ProductId = productId;
            productOption.Id        = Guid.NewGuid();

            var validation = _productValidator.ValidateProductOption(productOption);

            if (!validation.isOk)
            {
                throw new Exception($"Validation Error: {validation.reason}");
            }

            await _productOptionRepository.CreateOption(productOption);

            return(productOption);
        }