1

これは、オブジェクトのリストを返すコントローラーです。

public ActionResult ShowList(string site)
{
    var list = db.Objects.Where(x => x.protocol == site).ToArray();
    ViewBag.Files = list;
    return View();
}

インデックス.cshtml:

@model IQueryable<AutomationCapturesMVC.Models.Capture>
@{
    ViewBag.Title = "ShowList";
}

    <table>
        @foreach (var item in Model)
        {
            <tr>
                <td>@item.fileName</td>
                <td>@item.browser</td>
            </tr>
        }
    </table>

現在、NullReferenceException 私がチェックしたものを取得し、戻りリストは空ではありません

4

1 に答える 1