public IActionResult AdminImportGetAsync(string path, string districts) { string uploadPath = Configuration["UploadPath"]; string connectionString = _context.Database.GetDbConnection().ConnectionString; //Not using Hangfire BCBidImport.ImportJob(null, connectionString, uploadPath + path); var result = "Created Job: "; //Use Hangfire //var jobId = BackgroundJob.Enqueue(() => BCBidImport.ImportJob(null, connectionString, uploadPath + path)); //var result = "Created Job: " + jobId; return(new ObjectResult(result)); }
public IActionResult AdminImportGetAsync(string path, string districts) { string uploadPath = Configuration["UploadPath"]; string connectionString = _context.Database.GetDbConnection().ConnectionString; var result = "Created Job: "; lock (thisLock) { if (districts != null && districts == "388888") { //Not using Hangfire BCBidImport.ImportJob(null, connectionString, uploadPath + path); } else { //Use Hangfire var jobId = BackgroundJob.Enqueue(() => BCBidImport.ImportJob(null, connectionString, uploadPath + path)); result += jobId; } } return(new ObjectResult(result)); }