1
0
mirror of https://github.com/rudollee/LearningMVC.git synced 2025-06-07 16:06:21 +00:00
2017-04-10 00:31:18 +09:00

51 lines
1.3 KiB
Plaintext

@model SportsStore.Domain.Entities.Product
@{
ViewBag.Title = "Admin: Edit " + Model.Name;
Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
@*<h1>Edit @Model.Name</h1>
@using (Html.BeginForm())
{
@Html.EditorForModel()
<input type="submit" value="Save" />
@Html.ActionLink("Cancel and return to List", "Index")
}*@
<div class="panel">
<div class="panel-heading">
<h3>Edit @Model.Name</h3>
</div>
@using (Html.BeginForm("Edit", "Admin"))
{
<div class="panel-body">
@Html.HiddenFor(m => m.ProductID)
@foreach (var property in ViewData.ModelMetadata.Properties)
{
if (property.PropertyName != "ProeuctID")
{
<div class="form-group">
<label>@(property.DisplayName ?? property.PropertyName)</label>
@if (property.PropertyName == "Description")
{
@Html.TextArea(property.PropertyName, null, new { @class = "form-control", rows = 5 })
}
else
{
@Html.TextBox(property.PropertyName, null, new { @class = "form-control" })
}
@Html.ValidationMessage(property.PropertyName)
</div>
}
}
</div>
<div class="panel-footer">
<input type="submit" value="Save" class="btn btn-primary" />
@Html.ActionLink("Cancel and return to List", "Index", null, new { @class = "btn btn-default" } )
</div>
}
</div>