public async Task <bool> PurchasePhysicalProduct([FromServices] ICustomerRepository customerRepository, [FromServices] IShippingSlipRepository shippingSlipRepository, [FromServices] CreateOrderCommand createOrderCommand) { // basically preparing the data. Creating a customer and product. Customer cust1 = new Customer("Bartho"); customerRepository.Add(cust1); await customerRepository.UnitOfWork.SaveEntitiesAsync(); Product membership = new Product("Book", "Book", 20, ProductType.Book); ShoppingCartItem item = new ShoppingCartItem(); item.Quantity = 1; item.Product = membership; // Actual command var order = await createOrderCommand.Execute(cust1.Id, new List <ShoppingCartItem> { item }); var slip = await shippingSlipRepository.FindByOrderIdAsync(order.Id); return(true); }
public OrderedPhysicalProductDomainEventHandler(IShippingSlipRepository shippingSlipRepository) { _shippingSlipRepository = shippingSlipRepository ?? throw new ArgumentNullException(nameof(shippingSlipRepository)); }