public string Get(int projectId) { GitRepository repository = new GitRepository { ProjectId = projectId }; // make sure the repository exists if (!repository.repositoryPathExists()) { Response.StatusCode = Convert.ToInt16(HttpStatusCode.NotFound); } return repository.ToJson(); }
public void Delete(int projectId) { GitRepository repository = new GitRepository { ProjectId = projectId }; // make sure the repository exists if (!repository.repositoryPathExists()) { Response.StatusCode = Convert.ToInt16(HttpStatusCode.NotFound); } else if (repository.Remove()) { Response.StatusCode = Convert.ToInt16(HttpStatusCode.NoContent); } }
public void Put(int projectId) { GitRepository repository = new GitRepository { ProjectId = projectId }; // check if path already exists if (repository.repositoryPathExists()) { Response.StatusCode = Convert.ToInt16(HttpStatusCode.OK); } else { repository.Save(); // repository was created Response.StatusCode = Convert.ToInt16(HttpStatusCode.Created); } }