传入字典的模型项的类型为 'System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`
The model item passed into the dictionary is of type 'System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`
我在 运行 我的 mvc 应用程序时遇到以下错误:
{"The model item passed into the dictionary is of type
'System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`
1[PM.CManager.Clm.Domain.Models.Ln]]', b
ut this dictionary requires a model item of type 'PM.CManager.Clm.Domain.Models.Ln'."}
下面是我的控制器return值:
public ActionResult ClaimDetail()
{
//return View();
string id = "1000000246";
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
var LnDetail = _LnProxy.GetLnDetailByLnNum((string)id);
if (LnDetail == null)
{
return HttpNotFound();
}
return View(LnDetail);
}
以下是我的看法:
@model PM.CManager.Clm.Domain.Models.Ln
@using (Html.BeginForm())
{
<div class="panel panel-primary">
<div class="panel-heading inform" style="">
<table clases="panel-title inform">
<tr>
<td class="inform">Ln Number: <label id="Lnnum" name="Lnnum">1000100001</label></td>
<td class="inform">Status: <label id="Lnstatus" name="Lnstatus">Forclosure</label></td>
<td class="inform">Ln Type: <label id="Lntype" name="Lntype">Government(FHA)</label></td>
</tr>
</table>
</div>
下一行可能需要做哪些更改才能解决此问题?
@model PM.CManager.Clm.Domain.Models.Ln
您似乎从这一行返回了一个任务:
var LnDetail = _LnProxy.GetLnDetailByLnNum((string)id);
这需要更改为:
var LnDetail = await _LnProxy.GetLnDetailByLnNum((string)id);
那你需要把方法的签名改成:
public async Task<ActionResult> ClaimDetail() { /* ... */ }
另外请记住,如果它是一个集合或单个项目,并相应地调整您的视图。
我在 运行 我的 mvc 应用程序时遇到以下错误:
{"The model item passed into the dictionary is of type
'System.Threading.Tasks.Task`1[System.Collections.Generic.IEnumerable`
1[PM.CManager.Clm.Domain.Models.Ln]]', b
ut this dictionary requires a model item of type 'PM.CManager.Clm.Domain.Models.Ln'."}
下面是我的控制器return值:
public ActionResult ClaimDetail()
{
//return View();
string id = "1000000246";
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
var LnDetail = _LnProxy.GetLnDetailByLnNum((string)id);
if (LnDetail == null)
{
return HttpNotFound();
}
return View(LnDetail);
}
以下是我的看法:
@model PM.CManager.Clm.Domain.Models.Ln
@using (Html.BeginForm())
{
<div class="panel panel-primary">
<div class="panel-heading inform" style="">
<table clases="panel-title inform">
<tr>
<td class="inform">Ln Number: <label id="Lnnum" name="Lnnum">1000100001</label></td>
<td class="inform">Status: <label id="Lnstatus" name="Lnstatus">Forclosure</label></td>
<td class="inform">Ln Type: <label id="Lntype" name="Lntype">Government(FHA)</label></td>
</tr>
</table>
</div>
下一行可能需要做哪些更改才能解决此问题?
@model PM.CManager.Clm.Domain.Models.Ln
您似乎从这一行返回了一个任务:
var LnDetail = _LnProxy.GetLnDetailByLnNum((string)id);
这需要更改为:
var LnDetail = await _LnProxy.GetLnDetailByLnNum((string)id);
那你需要把方法的签名改成:
public async Task<ActionResult> ClaimDetail() { /* ... */ }
另外请记住,如果它是一个集合或单个项目,并相应地调整您的视图。