public string CreateAndReturnTreeNodeId(ContentTreeSectionInputModel contentTreeSectionInputModel)
 {
     throw new NotImplementedException();
     var newTreeNodeId = treeNodeSummaryContext.Create(contentTreeSectionInputModel.ParentTreeNodeId, typeof(SectionNodeProvider).AssemblyQualifiedName);
     contentTreeSectionInputModel.TreeNodeId = newTreeNodeId;
     return contentTreeSectionInputModel.TreeNodeId;
 }
        public virtual ActionResult Create(ContentTreeSectionInputModel contentTreeSectionInputModel)
        {
            if (ModelState.IsValid == false)
                return View("Modify", new ContentTreeSectionNodeViewModel()
                                      	{
                                      		ContentTreeSectionInputModel = contentTreeSectionInputModel,
                                            Action = "Create",
                                      	});

            var treeNodeIdString = contentTree.Create(contentTreeSectionInputModel.ParentTreeNodeId, typeof(SectionNodeProvider).AssemblyQualifiedName, typeof(ContentTreeSectionController).Name.Replace("Controller", string.Empty));

            commandBus.Send(new CreateSectionCommand()
                                {
                                    SectionId = guidGetter.GetGuid().ToString(),
                                    TreeNodeId = treeNodeIdString,
                                    DefaultTreeNodeId = contentTreeSectionInputModel.DefaultTreeNodeId,
                                    Name = contentTreeSectionInputModel.Name,
                                    ParentTreeNodeId = contentTreeSectionInputModel.ParentTreeNodeId,
                                    Sequence = contentTreeSectionInputModel.Sequence,
                                    UrlSegment = contentTreeSectionInputModel.UrlSegment,
                                    Hidden = contentTreeSectionInputModel.Hidden,
                                    Inactive = contentTreeSectionInputModel.Inactive,
                                    LastModifyBy = currentUserContext.GetCurrentPrincipal().Identity.Name,
                                });

            if (contentTreeSectionInputModel.Action.ToLower() == "save and exit")
                return new RedirectToRouteResult(new RouteValueDictionary()
                                             	{
                                             		{"controller", "ContentTree"},
                                                    {"action", "Index"},
                                             	});

            contentTreeSectionInputModel.TreeNodeId = treeNodeIdString;
            return new RedirectResult(GetRedirectUrlToModifyMethod(contentTreeSectionInputModel));
        }
 private string GetRedirectUrlToModifyMethod(ContentTreeSectionInputModel contentTreeSectionInputModel)
 {
     if (Url == null) return "/";
     return Url.Action("Modify", "ContentTreeSectionNode", new { treeNodeId = contentTreeSectionInputModel == null ? "0" : contentTreeSectionInputModel.TreeNodeId });
 }
        public virtual ActionResult Modify(ContentTreeSectionInputModel contentTreeSectionInputModel)
        {
            if (ModelState.IsValid == false)
                return View("Modify", new ContentTreeSectionNodeViewModel() { Action = "Modify", ContentTreeSectionInputModel = contentTreeSectionInputModel });

            commandBus.Send(new ModifySectionCommand()
                                {
                                    AggregateRootId = new Guid(contentTreeSectionInputModel.SectionId),
                                    SectionId = contentTreeSectionInputModel.SectionId,
                                    TreeNodeId = contentTreeSectionInputModel.TreeNodeId,
                                    DefaultTreeNodeId = contentTreeSectionInputModel.DefaultTreeNodeId,
                                    ParentTreeNodeId = contentTreeSectionInputModel.ParentTreeNodeId,
                                    UrlSegment = contentTreeSectionInputModel.UrlSegment,
                                    Sequence = contentTreeSectionInputModel.Sequence,
                                    Name = contentTreeSectionInputModel.Name,
                                    Hidden = contentTreeSectionInputModel.Hidden,
                                    Inactive = contentTreeSectionInputModel.Inactive,
                                    LastModifyBy = currentUserContext.GetCurrentPrincipal().Identity.Name
                                });

            if (contentTreeSectionInputModel.Action != null)
            {
                if (contentTreeSectionInputModel.Action.ToLower() == "save and exit")
                    return new RedirectToRouteResult(new RouteValueDictionary()
                                             	{
                                             		{"controller", "ContentTree"},
                                                    {"action", "Index"},
                                             	});
            }

            return new RedirectToRouteResult(new RouteValueDictionary()
                                             	{
                                             		{"controller", "ContentTreeSectionNode"},
                                                    {"action", "Modify"},
                                                    { "treenodeid", contentTreeSectionInputModel == null ? "0" : contentTreeSectionInputModel.TreeNodeId },
                                             	});
        }