var scope = (Url.ActionContext.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo.GetCustomAttribute<ControllerScopeAttribute>()?.Scope;
}
<div class="card">
<div class="form-horizontal">
<div class="card-body">
@foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit && !pm.HideSurroundingHtml))
{
if(scope=="Organ"&&prop.PropertyName=="OrganId")
var metadata = prop as Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadata;
var scope = (Url.ActionContext.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo.GetCustomAttribute<ControllerScopeAttribute>()?.Scope;
var controller = this.ViewContext.RouteData.Values["controller"].ToString();
var action = this.ViewContext.RouteData.Values["action"].ToString();
@Html.ValidationMessage(prop.PropertyName, new { @class = "text-danger" })
</div>
<div class="col-sm-6">
@{
if (metadata != null)
{
var attr = metadata.Attributes.Attributes.OfType<System.ComponentModel.DescriptionAttribute>().FirstOrDefault() as System.ComponentModel.DescriptionAttribute;
var scope = (Url.ActionContext.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo.GetCustomAttribute<ControllerScopeAttribute>()?.Scope;
var inputClass = "form-control";
var scope = ViewBag.ControllerScope as string;
}
@foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit))
{
var uihit = prop.TemplateHint ?? prop.DataTypeName;