public async Task <IActionResult> GetImportStatusById(string idParameter) { var getBulkImportResult = await _mediator.GetImportStatusAsync( idParameter, HttpContext.RequestAborted); // If the job is complete, we need to return 200 along with the completed data to the client. // Else we need to return 202 - Accepted. ImportResult bulkImportActionResult; if (getBulkImportResult.StatusCode == HttpStatusCode.OK) { bulkImportActionResult = ImportResult.Ok(getBulkImportResult.TaskResult); bulkImportActionResult.SetContentTypeHeader(OperationsConstants.BulkImportContentTypeHeaderValue); } else { bulkImportActionResult = ImportResult.Accepted(); } return(bulkImportActionResult); }