예제 #1
0
        public async Task HandleAsync(CreateProduct command, ICorrelationContext context)
        {
            if (await _productsRepository.ExistsAsync(command.Name))
            {
                throw new DistributedEStoreException("product_already_exists",
                                                     $"Product: '{command.Name}' already exists.");
            }

            var product = new DomainEntities.Product(command.Id, command.Name, command.Description,
                                                     command.Price, command.Category, command.ImageURLs, command.Colors);
            await _productsRepository.AddAsync(product);
        }
 public async Task UpdateAsync(DomainEntities.Product product)
 => await _repository.UpdateAsync(product);
 public async Task AddAsync(DomainEntities.Product product)
 => await _repository.AddAsync(product);