0

クエリの結果 (JSON) をコントローラーから部分ビューに渡したいので、次のように厳密な型を作成しました。

public class Suivi_Client
{
    public string ClientID { get; set; }
     public string Activite { get; set; }
     public string ClientName { get; set; }
}

// list 
public class Suivis
{
    public List<Suivi_Client> List_Clients { set; get; }
}

次に、部分ビュー:

 @model IEnumerable<Project.Models.Suivi_Client>
<html>
    <body>
<table border=1>
<thead>
  <tr>
   <th>
    ID
  </th>
   <th>
    Name
  </th>
        <th>
    Activite
  </th>
  </tr>
</thead>
@foreach(var item in Model){
foreach (var pop in item.List_Clients)
{
<tr>
    <td >
        @Html.DisplayFor(modelItem => pop.ClientID)
    </td>
    < <td >
        @Html.DisplayFor(modelItem => pop.ClientName)
    </td>
     <td >
        @Html.DisplayFor(modelItem => pop.Activite)
    </td>

</tr>
}
}
</table>
    </body>
    </html>

アクションメソッドは次のとおりです。

public ActionResult  Partial_suivi(string clients)
        {
         IEnumerable<Suivis> PopModel;
              var activit = (from x in frh.productivites
                         join y in frh.Clients on x.action equals y.ClientName
                         where x.action.Equals(clients)
                         select new { x.actionID,x.Activité,y.ClientName,y.Responsable,y.TempsCible,x.tempsmoy_ }).Distinct().ToArray();
        PopModel = activit;
            return PartialView(PopModel);
        }

しかし、私はこのエラーがあります: タイプ 'AnonymousType # 1 []' を 'Project.Models.Suivis に変換できません

このエラーを解決するにはどうすればよいですか?

4

1 に答える 1