public NodeDto CreateNode(Guid treeGuid, CreateNodeDto createNode) { GetTree(treeGuid); // throw if Tree doesn't exist var parentGuid = createNode.ParentGuid; if (parentGuid.HasValue) { GetNode(parentGuid.Value); // throw if Node doesn't exist } var entity = new NodeEntity( guid: Guid.NewGuid(), treeGuid: treeGuid, parentGuid: createNode.ParentGuid, name: createNode.Name, description: createNode.Description); _nodesCollections.InsertOne(entity); return(entity.ToDto()); }
public void Create(CreateNodeDto dto) { _service.Create(dto); }