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))); }
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))); }