@model IEnumerable<WebApplication1.Models.news>

@{
    ViewBag.Title = @ViewBag.title;
}

<h2>@ViewBag.title</h2>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.title)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.tag)
        </th>
        <th>
            category
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.title)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.tag)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.cat)
            </td>
            <td>
                @Html.ActionLink("Read", "../news/Details", new { id = item.ID })|
                @if (ViewBag.role > 0 || ViewBag.uid == item.userID)
                {

                    @Html.ActionLink("Edit", "../news/Edit", new { id = item.ID })
                    <span>|</span>
                    @Html.ActionLink("Delete", "../news/Delete", new { id = item.ID })
                }
            </td>
        </tr>
    }

</table>
