public async Task RunAsync(DispatchContainer command) { Task <Shipment> getShipmentTask = _shipments .GetShipmentAsync(command.ShipmentIdentity); Task <Supplier> getSupplierTask = _suppliers .GetSupplierAsync(command.SupplierIdentity); await Task.WhenAll(getShipmentTask, getSupplierTask); Shipment shipment = await getShipmentTask; Supplier supplier = await getSupplierTask; Money price = new(command.Price); Assignment assignment = new(command.ContainerIdentity, supplier.Identity, price); Container dispatchedContainer = shipment.Dispatch(assignment); supplier.Load(dispatchedContainer); Task saveShipmentTask = _shipments.SaveAsync(shipment); Task saveSupplierTask = _suppliers.SaveAsync(supplier); await Task.WhenAll(saveShipmentTask, saveSupplierTask); }
public Task <ShipmentViewModel> GetShipmentAsync(string code) { return(_shipmentRepository.GetShipmentAsync(code)); }