0

私はこの見解を持っています:

    @model IEnumerable<sn.Models.Order>



 <h2>

    **Name of Recipients**

 </h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
           Last Name
        </th>
        <th>
            Mark
        </th>
        <th>
           Quiz Number
        </th>
        <th>
          Pass
        </th>
        <th>
           Paid
        </th>
        <th>
           Mark Date
        </th>
     </tr>

@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Customer.LastName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Mark)
        </td>
        <td>
                @Html.DisplayFor(modelItem => item.QuizNo)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Pass)
            </td>
             <td>
                @Html.DisplayFor(modelItem => item.Paid)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.MarkDate)
            </td>
          </tr>
    }

</table>

以下は私の見解を示す画像です: 意見

受信者の名前の代わりにLastNameを表示したい。アイテムLastNameは、特定の顧客に対して変更されません。このビューにはそのユーザーの詳細が表示されており、これはコントローラーで結果を取得するために使用したコードの一部です。

var certificateDetails = db.orders.Where(p => p.ID == id);
return View( certificateDetails.ToPagedList(pageNumber, pageSize));
4

1 に答える 1

3
<h2>
    @(Model.Any() ? Model.First().Customer.LastName : "")
</h2>
于 2012-11-26T11:54:29.430 に答える