對於我的項目,我使用Web服務從數據庫獲取數據。 getAvailableList()方法在該服務中可用,並返回int []數組。我想把它轉換成對象,並且想把它傳遞給View。下面是 是Action方法。如何將int []轉換爲模型項
public ActionResult Ataxi()
{
var alist = IM.getAvailableList();
return View(alist);
}
這是我的看法
@model List<WEB1.Models.sub_employee>
@foreach(var item in Model){
if (item.SE_ID != null)
{
@Html.DisplayFor(modelItem => item.SE_ID)
}
}
我被傳遞到字典的模型項的錯誤消息的類型爲「System.Int32 []」,但本詞典需要類型的模型項目'System.Collections.Generic.List`1 [WEB1.Models.sub_employee]'。我如何克服這個問題?
你可以發佈獲取可用項目列表方法。 –
它位於WSDL Web服務 – OK91