protected virtual void BootstrapWorkspace(string workspaceDirectory)
 {
     if (!string.IsNullOrWhiteSpace(workspaceDirectory))
     {
         var workspace = _workspaceRepository.DefineWorkspace(workspaceDirectory);
         _workspaceRepository.CreateWorkspace(workspace);
     }
 }
예제 #2
0
        public bool CheckWorkspace(string directory, Func <string, bool> shouldCreate)
        {
            var workspace = GetWorkspace(directory);

            if (workspace == null && shouldCreate(directory))
            {
                workspace = _workspaceRepository.CreateWorkspace(directory);
            }

            return(workspace != null);
        }
예제 #3
0
        public JsonResult AddWorkspace(string token, [FromBody] Workspace value)
        {
            var user = _auth.Authenticate(token);

            if (string.IsNullOrEmpty(value.name))
            {
                throw new ArgumentException(nameof(value.name));
            }

            //var ws = new Workspace(value);
            _repo.CreateWorkspace(value, user);

            return(Json(new
            {
                success = true,
                data = value
            }));
        }