public vmBlock_DataForm Resolve(Source source, Destination destination, object formValue, string propertyName, UmbracoMappingContext context) { if (source != null) { var property = destination.GetType().GetProperties().Where(x => x.PropertyType == typeof(vmBlock_DataForm)).FirstOrDefault(); var ofType = schemaMetaService.GetOfType(property, "refs"); if (formValue != null && formValue.ToString() != string.Empty) { return(new vmBlock_DataForm() { TestForm = null, LiveForm = context.Html.Action("Render", "UmbracoForms", new { formId = formValue, view = "YuzuUmbracoForms.cshtml", template = ofType }).ToHtmlString() }); } } return(null); }
private Type AddConfigMapping <V>(PropertyInfo destProperty, ConfigType type) { var path = "/rows/config"; if (type == ConfigType.Cells) { path = "/rows/columns/config"; } var ofType = schemaMetaService.GetOfType(destProperty, "refs"); if (!string.IsNullOrEmpty(ofType)) { var configTypeName = schemaMetaService.Get(typeof(V), "refs", path, ofType).FirstOrDefault(); if (!string.IsNullOrEmpty(configTypeName)) { var configType = config.ViewModels.Where(x => x.Name == configTypeName).FirstOrDefault(); if (configType != null) { var configResolverType = typeof(GridConfigConverter <>).MakeGenericType(configType); importConfig.IgnoreViewmodels.Add(configType.Name); ManualMaps.Add(new YuzuTypeConvertorMapperSettings() { Mapper = typeof(IYuzuTypeConvertorMapper), Convertor = configResolverType }); return(configType); } } } return(null); }