public IActionResult AddBlock([FromBody] Models.ContentBlockModel model) { var block = (Extend.Block)contentService.CreateBlock(model.TypeName); if (block != null) { ViewBag.IsInGroup = !model.IncludeGroups; if (model.IncludeGroups) { ViewData.TemplateInfo.HtmlFieldPrefix = $"Blocks[{model.BlockIndex}]"; } else { ViewData.TemplateInfo.HtmlFieldPrefix = $"Blocks[{model.BlockIndex}].Items[0]"; } return(View("EditorTemplates/ContentEditBlock", new Models.ContentEditBlock() { Id = block.Id, CLRType = block.GetType().FullName, IsGroup = typeof(Extend.BlockGroup).IsAssignableFrom(block.GetType()), Value = block })); } return(new NotFoundResult()); }
public IActionResult AddBlock([FromBody] Models.ContentBlockModel model) { var block = (Extend.Block)contentService.CreateBlock(model.TypeName); if (block != null) { ViewData.TemplateInfo.HtmlFieldPrefix = $"Blocks[{model.BlockIndex}]"; return(View("EditorTemplates/ContentEditBlock", new Models.ContentEditBlock() { Id = block.Id, CLRType = block.GetType().FullName, Value = block })); } return(new NotFoundResult()); }