예제 #1
0
        public ActionResult <TreeNodeResponse> AddToRoot(TreeNodeCreateRequest request)
        {
            var treeNode = new TreeNodeDTO()
            {
                Name = request.Name
            };

            try
            {
                treeNode = _service.Create(treeNode);
            }
            catch (TreeNodeCreateException e)
            {
                return(Conflict(e.Message));
            }
            return(Ok(new TreeNodeResponse(treeNode)));
        }
예제 #2
0
        public ActionResult <TreeNodeResponse> AddChildNode(string name, TreeNodeCreateRequest request)
        {
            var treeNode = new TreeNodeDTO()
            {
                Name = request.Name
            };

            try
            {
                treeNode = _service.Create(name, treeNode);
            }
            catch (TreeNodeCreateException e)
            {
                return(Conflict(e.Message));
            }
            if (treeNode == null)
            {
                return(NotFound());
            }
            return(Ok(new TreeNodeResponse(treeNode)));
        }