show currect news list and user name in news detals

This commit is contained in:
2024-08-01 16:35:13 +03:30
parent 075e75e62d
commit d73b5dc266
5 changed files with 101 additions and 38 deletions

View File

@ -1,4 +1,7 @@
@model IEnumerable<WebApplication1.Models.news>
@using WebApplication1.Models
@model IEnumerable<newsModel>
@{
ViewBag.Title = "Index";
}
@ -11,46 +14,53 @@
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.title)
title
</th>
<th>
@Html.DisplayNameFor(model => model.cat)
category
</th>
<th>
@Html.DisplayNameFor(model => model.publishDate)
tag
</th>
<th>
@Html.DisplayNameFor(model => model.userID)
publish date
</th>
<th>
@Html.DisplayNameFor(model => model.views)
publisher
</th>
<th>
Views
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.title)
</td>
<td>
@Html.DisplayFor(modelItem => item.cat)
</td>
<td>
@Html.DisplayFor(modelItem => item.publishDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.userID)
</td>
<td>
@Html.DisplayFor(modelItem => item.views)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
</td>
</tr>
}
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.category)
</td>
<td>
@Html.DisplayFor(modelItem => item.tag)
</td>
<td>
@Html.DisplayFor(modelItem => item.date)
</td>
<td>
@Html.DisplayFor(modelItem => item.DisplayName)
</td>
<td>
@Html.DisplayFor(modelItem => item.views)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.NewsID }) |
@Html.ActionLink("Details", "Details", new { id = item.NewsID }) |
@Html.ActionLink("Delete", "Delete", new { id = item.NewsID })
</td>
</tr>
}
</table>