コード例 #1
0
        public async Task <ProductDto> SaveProductAsync(ProductDto product)
        {
            var entity = ProductMapper.DtoToEntityMap(product);

            if (!await _productValidationService.Validate(entity))
            {
                throw new ValidationException("The product didn't pass validation");
            }

            entity = await _productRepository.InsertAsync(entity);

            return(ProductMapper.EntityToDtoMap(entity));
        }