|
|
|
@ -6,7 +6,7 @@
|
|
|
|
|
@foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit))
|
|
|
|
|
{
|
|
|
|
|
var metadata = prop as Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadata;
|
|
|
|
|
object propValue = Model == null ? (prop.ModelType.IsValueType ? Activator.CreateInstance(prop.ModelType) : null) : null;
|
|
|
|
|
object propValue = Model == null ? (prop.ModelType.IsValueType ? Activator.CreateInstance(prop.ModelType) : null) : ViewData.ModelMetadata.ModelType.GetProperty(prop.PropertyName).GetValue(ViewData.Model);
|
|
|
|
|
if (prop.HideSurroundingHtml)
|
|
|
|
|
{
|
|
|
|
|
@Html.Hidden(prop.PropertyName)
|
|
|
|
@ -18,25 +18,13 @@
|
|
|
|
|
var htmlClass = "col-sm-2 col-form-label";
|
|
|
|
|
htmlClass += isRequired ? " required" : "";
|
|
|
|
|
<div class="form-group row">
|
|
|
|
|
@if (prop.ModelType != typeof(bool))
|
|
|
|
|
{
|
|
|
|
|
@Html.Label(prop.PropertyName, prop.GetDisplayName() + ":", new { @class = htmlClass })
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<div class="col-sm-2"></div>
|
|
|
|
|
}
|
|
|
|
|
@Html.Label(prop.PropertyName, prop.GetDisplayName() + ":", new { @class = htmlClass })
|
|
|
|
|
<div class="col-sm-8">
|
|
|
|
|
@if (metadata.Attributes.Attributes.Any(o => o.GetType() == typeof(System.ComponentModel.ReadOnlyAttribute)))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
<div class="form-control form-control-display">
|
|
|
|
|
@Html.Hidden(prop.PropertyName)
|
|
|
|
|
@Html.Display(prop.PropertyName, prop.DataTypeName ?? prop.TemplateHint)
|
|
|
|
|
@if (prop.ModelType == typeof(bool))
|
|
|
|
|
{
|
|
|
|
|
@Html.Label(prop.PropertyName, prop.DisplayName + ":", new { @class = "form-check-label" })
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
else if (!string.IsNullOrEmpty(uihit) && !(uihit == "EmailAddress" || uihit == "PhoneNumber"))
|
|
|
|
@ -60,15 +48,13 @@
|
|
|
|
|
@Html.TextBox(prop.PropertyName, null, new { @class = inputClass })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (prop.ModelType == typeof(bool))
|
|
|
|
|
else if (prop.ModelType == typeof(bool) || prop.UnderlyingOrModelType == typeof(bool))
|
|
|
|
|
{
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<div class="form-check">
|
|
|
|
|
@Html.CheckBox(prop.PropertyName, new { @class = "form-check-input" })
|
|
|
|
|
@Html.Label(prop.PropertyName, prop.DisplayName, new { @class = "form-check-label" })
|
|
|
|
|
</div>
|
|
|
|
|
<div style="padding:9px 0;">
|
|
|
|
|
@Html.CheckBox(prop.PropertyName, new { style = "width:20px;height:20px;" })
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@Html.TextBox(prop.PropertyName, null, new { @class = inputClass })
|
|
|
|
|