public static void RenderDesignerFor(this HtmlHelper htmlHelper, ProfileProperty property)
        {
            IPropertyType propertyType = new PropertyTypeResolver().ResolveAll()
               .Single(x => x.Name == property.PropertyType);

            htmlHelper.RenderPartial(propertyType.Settings.Name, property.Details);
        }
Exemplo n.º 2
0
        public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var propertyType = (ProfileProperty)base.BindModel(controllerContext, bindingContext);

            IPropertyType type = new PropertyTypeResolver().ResolveAll()
                .Single(x => x.Name == propertyType.PropertyType);

            var modelMetadata = bindingContext.PropertyMetadata["Details"];

            propertyType.Details = (PropertyTypeDetails)base.BindModel(controllerContext, new ModelBindingContext(bindingContext)
            {
                ModelMetadata = new ModelMetadata(ModelMetadataProviders.Current, modelMetadata.ContainerType, null, type.Settings, modelMetadata.PropertyName),
                ModelName = string.Empty
            });

            return propertyType;
        }
        public ActionResult RenderDetails(string name)
        {
            IPropertyType propertyType = new PropertyTypeResolver().ResolveAll()
            .Single(x => x.Name == name);

            return PartialView(propertyType.Settings.Name);
        }