public async Task BuildProject(int projectId, int userId, ProjectLanguageType languageType) { var archive = await _projectStructureService.CreateProjectZipFile(projectId); var uri = await _blobRepo.UploadProjectArchiveAsync(archive, $"project_{projectId}"); var build = await CreateStartBuildResult(projectId, userId); var message = new ProjectForBuildDTO() { ProjectId = projectId, UriForProjectDownload = uri, Language = languageType, TimeStamp = DateTime.Now, BuildId = build.Id }; var strMessage = JsonConvert.SerializeObject(message); _queueService.SendBuildMessage(strMessage); }
public async Task <ActionResult> DownloadProject(int projectId) { try { const string contentType = "application/zip"; HttpContext.Response.ContentType = contentType; var fileByteArray = await _projectStructureService.CreateProjectZipFile(projectId).ConfigureAwait(false); var project = await _projectService.GetProjectById(projectId).ConfigureAwait(false); return(new FileContentResult(fileByteArray ?? new byte[0], contentType) { FileDownloadName = project.Name }); } catch (Exception ex) { _logger.LogWarning(LoggingEvents.GetItemNotFound, $"File on server not found. ${ex.Message}"); return(NotFound()); } }