add categories(add, list, list news)
minor form changes add news controller and views
This commit is contained in:
@ -21,7 +21,9 @@
|
||||
<li>@Html.ActionLink("About", "About", "Home", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
<li>@Html.ActionLink("Contact", "Contact", "Home", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
<li>@Html.ActionLink("user setting", "index", "users", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
|
||||
<li>@Html.ActionLink("news", "index", "users", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
<li>@Html.ActionLink("categories", "index", "categories", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
36
Views/categories/Create.cshtml
Normal file
36
Views/categories/Create.cshtml
Normal file
@ -0,0 +1,36 @@
|
||||
@model WebApplication1.Models.category
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Create";
|
||||
}
|
||||
|
||||
<h2>Create</h2>
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>category</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.title, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.title, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.title, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
40
Views/categories/Delete.cshtml
Normal file
40
Views/categories/Delete.cshtml
Normal file
@ -0,0 +1,40 @@
|
||||
@model WebApplication1.Models.category
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Delete";
|
||||
}
|
||||
|
||||
<h2>Delete</h2>
|
||||
|
||||
<h3>Are you sure you want to delete this?</h3>
|
||||
<div>
|
||||
<h4>category</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.link)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.link)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.title)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.title)
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
@using (Html.BeginForm()) {
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-actions no-color">
|
||||
<input type="submit" value="Delete" class="btn btn-default" /> |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
49
Views/categories/Details.cshtml
Normal file
49
Views/categories/Details.cshtml
Normal file
@ -0,0 +1,49 @@
|
||||
@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.link)
|
||||
</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.link)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.tag)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.cat)
|
||||
</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>
|
||||
}
|
||||
|
||||
</table>
|
||||
45
Views/categories/Edit.cshtml
Normal file
45
Views/categories/Edit.cshtml
Normal file
@ -0,0 +1,45 @@
|
||||
@model WebApplication1.Models.category
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Edit";
|
||||
}
|
||||
|
||||
<h2>Edit</h2>
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>category</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
@Html.HiddenFor(model => model.ID)
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.link, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.link, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.link, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.title, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.title, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.title, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Save" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
39
Views/categories/Index.cshtml
Normal file
39
Views/categories/Index.cshtml
Normal file
@ -0,0 +1,39 @@
|
||||
@model IEnumerable<WebApplication1.Models.category>
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
}
|
||||
|
||||
<h2>Index</h2>
|
||||
|
||||
<p>
|
||||
@Html.ActionLink("Create New", "Create")
|
||||
</p>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.link)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.title)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.link)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.title)
|
||||
</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>
|
||||
}
|
||||
|
||||
</table>
|
||||
107
Views/news/Create.cshtml
Normal file
107
Views/news/Create.cshtml
Normal file
@ -0,0 +1,107 @@
|
||||
@model WebApplication1.Models.news
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Create";
|
||||
}
|
||||
|
||||
<h2>Create</h2>
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>news</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.title, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.title, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.title, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.image, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.image, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.image, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.link, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.link, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.link, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.summary, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.summary, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.summary, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.cat, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.cat, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.cat, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.tag, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.tag, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.tag, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.publishDate, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.publishDate, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.publishDate, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.userID, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.userID, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.userID, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.Content, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.Content, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.Content, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.views, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.views, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.views, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
104
Views/news/Delete.cshtml
Normal file
104
Views/news/Delete.cshtml
Normal file
@ -0,0 +1,104 @@
|
||||
@model WebApplication1.Models.news
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Delete";
|
||||
}
|
||||
|
||||
<h2>Delete</h2>
|
||||
|
||||
<h3>Are you sure you want to delete this?</h3>
|
||||
<div>
|
||||
<h4>news</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.title)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.title)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.image)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.image)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.link)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.link)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.summary)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.summary)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.cat)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.cat)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.tag)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.tag)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.publishDate)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.publishDate)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.userID)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.userID)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Content)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Content)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.views)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.views)
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
@using (Html.BeginForm()) {
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-actions no-color">
|
||||
<input type="submit" value="Delete" class="btn btn-default" /> |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
98
Views/news/Details.cshtml
Normal file
98
Views/news/Details.cshtml
Normal file
@ -0,0 +1,98 @@
|
||||
@model WebApplication1.Models.news
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Details";
|
||||
}
|
||||
|
||||
<h2>Details</h2>
|
||||
|
||||
<div>
|
||||
<h4>news</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.title)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.title)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.image)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.image)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.link)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.link)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.summary)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.summary)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.cat)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.cat)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.tag)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.tag)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.publishDate)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.publishDate)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.userID)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.userID)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Content)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Content)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.views)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.views)
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = Model.ID }) |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</p>
|
||||
109
Views/news/Edit.cshtml
Normal file
109
Views/news/Edit.cshtml
Normal file
@ -0,0 +1,109 @@
|
||||
@model WebApplication1.Models.news
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Edit";
|
||||
}
|
||||
|
||||
<h2>Edit</h2>
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>news</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
@Html.HiddenFor(model => model.ID)
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.title, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.title, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.title, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.image, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.image, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.image, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.link, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.link, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.link, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.summary, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.summary, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.summary, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.cat, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.cat, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.cat, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.tag, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.tag, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.tag, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.publishDate, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.publishDate, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.publishDate, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.userID, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.userID, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.userID, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.Content, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.Content, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.Content, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.views, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.views, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.views, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Save" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
87
Views/news/Index.cshtml
Normal file
87
Views/news/Index.cshtml
Normal file
@ -0,0 +1,87 @@
|
||||
@model IEnumerable<WebApplication1.Models.news>
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
}
|
||||
|
||||
<h2>Index</h2>
|
||||
|
||||
<p>
|
||||
@Html.ActionLink("Create New", "Create")
|
||||
</p>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.title)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.image)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.link)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.summary)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.cat)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.tag)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.publishDate)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.userID)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Content)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.views)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.title)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.image)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.link)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.summary)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.cat)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.tag)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.publishDate)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.userID)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Content)
|
||||
</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>
|
||||
}
|
||||
|
||||
</table>
|
||||
@ -10,46 +10,46 @@
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>user</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
@Html.HiddenFor(model => model.ID)
|
||||
<div class="form-horizontal">
|
||||
<h4>user</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
@Html.HiddenFor(model => model.ID)
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.usename, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.usename, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
|
||||
@Html.ValidationMessageFor(model => model.usename, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.password, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.password, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.password, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.displayname, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.displayname, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.displayname, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
|
||||
@Html.ActionLink("back to account managment", "index", null, new { @class = "btn btn-outline-dark" })
|
||||
|
||||
<input type="submit" value="Save" class="btn btn-outline-dark" />
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.usename, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.usename, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
|
||||
@Html.ValidationMessageFor(model => model.usename, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.password, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.password, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.password, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.displayname, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.displayname, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.displayname, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
|
||||
@Html.ActionLink("back to account managment", "index", null, new { @class = "btn btn-outline-dark" })
|
||||
|
||||
<input type="submit" value="Save" class="btn btn-outline-dark" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@ -37,6 +37,13 @@
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.displayname)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.role)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@ViewBag.role
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.password, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.password, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.EditorFor(model => model.password, new { htmlAttributes = new {@type="password", @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.password, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -9,7 +9,22 @@
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<script>
|
||||
function checkPasswords() {
|
||||
var password = document.getElementById("password");
|
||||
var confirmPassword = document.getElementById("ConfirmPassword");
|
||||
var errorMessage = document.getElementById("passwordMismatch");
|
||||
|
||||
if (password.value !== confirmPassword.value) {
|
||||
errorMessage.textContent = "Passwords do not match.";
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
errorMessage.textContent = "";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="form-horizontal">
|
||||
<h4>user</h4>
|
||||
<hr />
|
||||
@ -25,11 +40,17 @@
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.password, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.PasswordFor(model => model.password, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.EditorFor(model => model.password, new { htmlAttributes = new {@id="password", @type = "password", @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.password, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-2">Confirm password</label>
|
||||
<input type="password" , id="ConfirmPassword", oninput="checkPasswords()" class="form-control" />
|
||||
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
|
||||
<span id="passwordMismatch" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
Reference in New Issue
Block a user