Ejemplo n.º 1
0
        public async Task CreateContentNode(ContentNode node)
        {
            node.Id = Guid.NewGuid().ToString();

            //TODO: Add validation
            if (string.IsNullOrEmpty(node.CssColumnSize))
            {
                node.CssColumnSize = "12";
            }

            if (string.IsNullOrEmpty(node.ViewId) && !string.IsNullOrEmpty(node.WidgetType))
            {
                node.ViewId = _widgetProvider.GetDefaultViewId(node.WidgetType);
            }

            if (node.ParentId == null)
            {
                node.SetStyle(ContentStyle.DefaultRootStyle);
            }
            else
            {
                node.SetStyle(ContentStyle.DefaultStyle);
            }


            _connectDb.ContentNodes.Add(node);

            await _connectDb.SaveChangesAsync();
        }