Ejemplo n.º 1
0
        public JsonResult GetMacroProperty(int id)
        {
            using (var db = DatabaseContext.Database)
            {
                var properties = db.Fetch <CanvasMacroProperty>("SELECT * FROM cmsMacroProperty where macro = @0 ORDER BY macroPropertySortOrder", id);

                if (CanvasHelper.GetUmbracoVersion() == 6)
                {
                    var macroPropertyTypes = db.Fetch <dynamic>("SELECT * FROM cmsMacroPropertyType");

                    foreach (var p in properties)
                    {
                        var type = macroPropertyTypes.FirstOrDefault(x => x.id == p.macroPropertyType);

                        if (type != null)
                        {
                            p.editorAlias = type.macroPropertyTypeRenderType;
                        }
                    }
                }

                return(Json(new { success = true, properties = properties }));
            }
        }