display news list and individual
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
@model WebApplication1.Models.news
|
||||
@using WebApplication1.Models
|
||||
@model news
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Details";
|
||||
var _user = ViewBag.user as user;
|
||||
}
|
||||
|
||||
<h2>Details</h2>
|
||||
@ -23,8 +25,8 @@
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
<img src="@Model.image" />
|
||||
@Html.DisplayFor(model => model.image)
|
||||
<img src="@Url.Content(Model.image)" height="250" width="200" />
|
||||
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@ -68,11 +70,11 @@
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.userID)
|
||||
original poster
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.userID)
|
||||
@_user.displayname
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
@model IEnumerable<WebApplication1.Models.news>
|
||||
@using WebApplication1.Models
|
||||
@model List<newsModel>
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
}
|
||||
@ -11,19 +12,22 @@
|
||||
<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)
|
||||
Publisher
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.views)
|
||||
Published On
|
||||
</th>
|
||||
<th>
|
||||
views
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
@ -31,24 +35,27 @@
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.title)
|
||||
@Html.DisplayFor(modelItem => item.Title)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.cat)
|
||||
@Html.DisplayFor(modelItem => item.category)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.publishDate)
|
||||
@Html.DisplayFor(modelItem => item.tag)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.userID)
|
||||
@Html.DisplayFor(modelItem => item.DisplayName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.date)
|
||||
</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 })
|
||||
@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>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user