예제 #1
0
        public override PipelineProcessorResponseValue ProcessRequest()
        {
            var itemTitle = RequestContext.Argument;

            if (ItemUtil.IsItemNameValid(itemTitle ?? string.Empty))
            {
                var currentItem = RequestContext.Item;
                var currentBlog = _blogManager.GetCurrentBlog(currentItem);
                if (currentBlog != null)
                {
                    var templateId = GetTemplateId(currentBlog);
                    var parentItem = GetParentItem(currentBlog);

                    Item newItem = _itemManager.AddFromTemplate(itemTitle, templateId, parentItem);

                    return(new PipelineProcessorResponseValue
                    {
                        Value = new
                        {
                            itemId = newItem.ID.Guid
                        }
                    });
                }
            }
            return(new PipelineProcessorResponseValue
            {
                Value = null
            });
        }