private void AddSecondaryCallJob(CreateDeliveryCommand command) { FluentScheduler.JobManager.AddJob( async() => { await _legacyApiClient.CreatePackage(new CreatePackageCommand { Barcode = command.Barcode, Destination = command.Destination, Source = command.Source }); }, schedule => schedule.ToRunOnceAt(DateTime.Now.AddSeconds(1))); }
public async Task <IActionResult> Post(CreatePackageCommand command) { command.Source = SourceConsts.Legacy; var response = await _legacyApiClient.CreatePackage(command); if (!response.IsSuccessStatusCode) { return(this.StatusCode((int)response.StatusCode, response.Content)); } AddSecondaryCallJob(command); return(this.StatusCode((int)response.StatusCode, response.Content)); }