我将两个列表变量传递给ActionResult,如下所示。
public ActionResult Index()
{
List<category> cat = _business.ViewAllcat().ToList();
List<Books> book = _business.ViewAllBooks().ToList();
return View(book);
}
当我运行代码时,我遇到了以下错误:
传递给字典的模型项的类型是 System.Collections.Generic.List1[Durgesh_Bhai.Models.category], 但该字典需要类型为 System.Collections.Generic.IEnumerable1[Durgesh_Bhai.Models.Books] 的模型项。
当我在 ActionResult 中只使用一个列表时,它可以正常工作。