Asynchronous Orchard-在新线程中调用外部服务

Asynchronous Orchard-在新线程中调用外部服务,asynchronous,orchardcms,Asynchronous,Orchardcms,我需要装箱处理外部服务调用的新线程。在我的模块控制器中 我需要将创建的内容项的id插入线程方法并使用Orchard服务 我的情况: ( public异步任务CreateApplication(应用postApply) { if(ModelState.IsValid) { var myItem=this._services.ContentManager.New(“Zadosti”); 动态dynContentItem=myItem; dynContentItem.Zadosti.Jmeno.Val

我需要装箱处理外部服务调用的新线程。在我的模块控制器中

我需要将创建的内容项的id插入线程方法并使用Orchard服务

我的情况: (

public异步任务CreateApplication(应用postApply)
{
if(ModelState.IsValid)
{
var myItem=this._services.ContentManager.New(“Zadosti”);
动态dynContentItem=myItem;
dynContentItem.Zadosti.Jmeno.Value=postApply.Name;
dynContentItem.Zadosti.Prijmeni.Value=postApply.SureName;
此._services.ContentManager.Publish(myItem);
//我需要获取已创建内容项的ID,并在新线程中调用方法
CallMethodInNewThread(idOdContentItem);
}
}
CallMethodInNewThread(int id){
//外部服务异步调用->等待响应
//从数据库获取具有“id”的内容项
//更新并保存内容项
}

谢谢你的帮助

在callI中使用
wait
关键字不要等待响应。。。我希望立即将视图返回给用户并在后台运行新线程(CallMethodInNewThread),在这个方法中,我需要使用IContentManager。。。
public async Task<ActionResult> CreateApplication(Apply postApply)
{
  if (ModelState.IsValid)
  {
     var myItem = this._services.ContentManager.New("Zadosti");
     dynamic dynContentItem = myItem;
     dynContentItem.Zadosti.Jmeno.Value = postApply.Name;
     dynContentItem.Zadosti.Prijmeni.Value = postApply.SureName;
     this._services.ContentManager.Publish(myItem);

     // I need to get ID of created content item and call method in new thread
     CallMethodInNewThread(idOdContentItem);


  }
}

CallMethodInNewThread(int id){
   // External service async  CALL -> wait for response
   // Get content item with "id" from DB
   // Update and save content item
}