Пример #1
0
        public async Task <IActionResult> Index(FinishFormModel formModel)
        {
            Console.WriteLine("File Session Id: " + formModel.FileSessionId);

            // Set Status to Finializing
            var sessionResponse = SetSessionStatus(formModel.SessionId, "Finializing");

            // Initiate Snapshot
            var client   = new HttpAuthClient();
            var response = await StartSnapshot(formModel.SessionId, formModel.FileSessionId);

            var snapshotResponse = await WaitForSnapshotResponse(formModel.SessionId, formModel.FileSessionId);

            // Download Snapshot
            var snapshotStream = await DownloadSnapshot(snapshotResponse.DownloadURL);

            Console.WriteLine("Download URL: " + snapshotResponse.DownloadURL);

            // Delete Session
            response = await DeleteSession(formModel.SessionId);

            // Start Checkin
            var projectFilesResponse = await CheckinProjectFile(formModel.ProjectId, formModel.FileProjectId);

            var projectsHelper = new ProjectsHelper();
            var awsStrResponse = await projectsHelper.UploadToAWS(projectFilesResponse, snapshotStream);

            Console.WriteLine("AWS Response: " + awsStrResponse);


            // Confirm Checkin
            response = await ConfirmCheckin(formModel.ProjectId, formModel.FileProjectId);

            var flattenResponse = await StartFlattenJob(formModel.ProjectId, formModel.FileProjectId);

            // Get Shared Link
            var sharedLinkResponse = await GetShareLink(formModel.ProjectId, formModel.FileProjectId);

            var model = new FinishModel()
            {
                ProjectLink = sharedLinkResponse.ShareLink
            };

            return(View(model));
        }