show currect news list and user name in news detals
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Details";
|
||||
|
||||
}
|
||||
|
||||
<h2>Details</h2>
|
||||
@ -23,8 +24,7 @@
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
<img src="@Model.image" />
|
||||
@Html.DisplayFor(model => model.image)
|
||||
<img src="@Url.Content(Model.image)" height="270" width="200" />
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@ -72,7 +72,7 @@
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.userID)
|
||||
@ViewBag.user.displayname
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
|
||||
@ -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>
|
||||
|
||||
Reference in New Issue
Block a user