public async Task <IList <string> > Handle(ReOrderCommand request, CancellationToken cancellationToken) { if (request.Order == null) { throw new ArgumentNullException("order"); } var warnings = new List <string>(); var customer = await _customerService.GetCustomerById(request.Order.CustomerId); foreach (var orderItem in request.Order.OrderItems) { var product = await _productService.GetProductById(orderItem.ProductId); if (product != null) { if (product.ProductType == ProductType.SimpleProduct) { warnings.AddRange(await _shoppingCartService.AddToCart(customer, orderItem.ProductId, ShoppingCartType.ShoppingCart, request.Order.StoreId, orderItem.WarehouseId, orderItem.AttributesXml, orderItem.UnitPriceExclTax, orderItem.RentalStartDateUtc, orderItem.RentalEndDateUtc, orderItem.Quantity, false)); } } else { warnings.Add("Product is not available"); } } return(warnings); }
public async Task <IList <string> > Handle(ReOrderCommand request, CancellationToken cancellationToken) { if (request.Order == null) { throw new ArgumentNullException("order"); } var warnings = new List <string>(); var customer = await _customerService.GetCustomerById(request.Order.CustomerId); foreach (var orderItem in request.Order.OrderItems) { var product = await _productService.GetProductById(orderItem.ProductId); if (product != null) { if (product.ProductType == ProductType.SimpleProduct) { warnings.AddRange(await _shoppingCartService.AddToCart(customer, orderItem.ProductId, ShoppingCartType.ShoppingCart, request.Order.StoreId, orderItem.WarehouseId, orderItem.AttributesXml, product.CustomerEntersPrice ? orderItem.UnitPriceExclTax : (decimal?)default,