fix edit news
This commit is contained in:
@ -94,6 +94,12 @@
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = Model.ID }) |
|
||||
@if (@ViewBag.role == 1)
|
||||
{
|
||||
@Html.ActionLink("Edit", "Edit", new { id = Model.ID })
|
||||
<span>
|
||||
|
|
||||
</span>
|
||||
}
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</p>
|
||||
|
||||
@ -6,15 +6,14 @@
|
||||
|
||||
<h2>Edit</h2>
|
||||
|
||||
@using (Html.BeginForm())
|
||||
@using (Html.BeginForm("Edit", "news", FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
|
||||
<div class="form">
|
||||
<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" })
|
||||
@ -24,14 +23,6 @@
|
||||
</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">
|
||||
@ -41,17 +32,21 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.summary, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
@Html.LabelFor(model => model.image, 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" })
|
||||
@Html.EditorFor(model => model.image, new { htmlAttributes = new { @type = "file", @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.image, "", 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" } })
|
||||
<label class="control-label col-md-2">category</label>
|
||||
<div>
|
||||
<select id="cat" name="Cat" class="form-control" multiple>
|
||||
@foreach (var item in ViewBag.categoryTitle)
|
||||
{
|
||||
<option value="@item.title">@item.title</option>
|
||||
}
|
||||
</select>
|
||||
@Html.ValidationMessageFor(model => model.cat, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
@ -59,46 +54,35 @@
|
||||
<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" } })
|
||||
<select id="tag" name="Tags" class="form-control" multiple>
|
||||
@foreach (var item in ViewBag.tagTitle)
|
||||
{
|
||||
<option value="@item.title">@item.title</option>
|
||||
}
|
||||
</select>
|
||||
@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" })
|
||||
@Html.LabelFor(model => model.summary, 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" })
|
||||
@Html.TextAreaFor(model => model.summary, new { @class = "form-control" })
|
||||
@Html.ValidationMessageFor(model => model.summary, "", 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.TextAreaFor(model => model.Content, 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>
|
||||
<br />
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Save" class="btn btn-default" />
|
||||
<input type="submit" value="Create" class="btn btn-outline-dark" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user