private async Task CreateBranchAsync(string projectId, string branchName, byte[] content) { string mkdocsContent = Encoding.UTF8.GetString(content); var branch = new BranchDto { Name = branchName, MkDocsYaml = mkdocsContent }; await _branchService.CreateBranchAsync(projectId, branch); }
public async Task <IActionResult> Post(string projectId, [FromBody] BranchDto branch) { var authorization = await _authorizationService.AuthorizeAsync(User, new ProjectDto { Id = projectId }, Operations.Update); if (!authorization.Succeeded) { return(Forbid()); } await _branchesService.CreateBranchAsync(projectId, branch); return(Created($"/projects/{projectId}/branches/{branch.Name}", branch)); }
public async Task <IActionResult> Post(string projectId, [FromBody] BranchDto branch) { await _branchesService.CreateBranchAsync(projectId, branch); return(Created($"/projects/{projectId}/branches/{branch.Name}", branch)); }