public async Task HandleAsync(DeleteProductCommand args) { var product = await _repository .GetAsync(args.Id); _repository .Delete(product); await _unitOfWork .CommitAsync(); }
public async Task HandleAsync(RegisterCustomerCommand command) { var customerName = CustomerName .Create(command.CustomerName); var customer = new Customer(customerName.Value); _repository .Add(customer); await _unitOfWork .CommitAsync(); }
public async Task HandleAsync(RegisterProductCommand args) { var productName = ProductName .Create(args.ProductName); if (productName.IsSuccess) { var product = new Product(productName.Value); _repository .Add(product); await _unitOfWork .CommitAsync(); } }
public async Task HandleAsync(EditProductCommand command) { var product = await _repository .GetAsync(command.Id); var productName = ProductName .Create(command.ProductName); product .Edit(productName.Value); _repository .Modify(product); await _unitOfWork .CommitAsync(); }