Я использую следующие коды ..модель элемент передается в словарь типа «System.Collections.Generic.List`1 [System.String]», но требует типа «что-то еще»
контроллера:
public ActionResult Comments(int? Id)
{
var abccomment= db.xyzComments.Include(c=>c.XYZMasters);
var comments = (from x in abccomment
where Id == x.CcId
select x.Comment).Distinct().ToList();
return View(comments);
}
и мой взгляд
@model IEnumerable<Pharman.Models.XYZMaster>
@foreach (var item in Model)
{
@item.XYZComment.Comment
}
Я получаю следующее сообщение об ошибке: модели элемент передается в словарь типа «System.Collections.Generic.List 1[System.String]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable
1 [farma.Models.XYZMaster].
Просьба помочь ... ТИА
этой аналогичен этому сообщению: - http://stackoverflow.com/questions/4813307/the-model-item-passed-into-the-dictionary-is-of-type-but-this-dictionary-req – sankoobaba