Ejemplo n.º 1
0
        public async Task <object> Get(GetSyncJobItemFile request)
        {
            var jobItem = _syncManager.GetJobItem(request.Id);

            if (jobItem == null)
            {
                throw new ResourceNotFoundException();
            }

            if (jobItem.Status < SyncJobItemStatus.ReadyToTransfer)
            {
                throw new ArgumentException("The job item is not yet ready for transfer.");
            }

            await _syncManager.ReportSyncJobItemTransferBeginning(request.Id).ConfigureAwait(false);

            return(await ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions
            {
                Path = jobItem.OutputPath,
                OnError = () =>
                {
                    var failedTask = _syncManager.ReportSyncJobItemTransferFailed(request.Id);
                    Task.WaitAll(failedTask);
                }
            }).ConfigureAwait(false));
        }
Ejemplo n.º 2
0
        public object Get(GetSyncJobItemFile request)
        {
            var jobItem = _syncManager.GetJobItem(request.Id);

            if (jobItem.Status != SyncJobItemStatus.Transferring)
            {
                throw new ArgumentException("The job item is not yet ready for transfer.");
            }

            return(ToStaticFileResult(jobItem.OutputPath));
        }
Ejemplo n.º 3
0
        public object Get(GetSyncJobItemFile request)
        {
            var jobItem = _syncManager.GetJobItem(request.Id);

            if (jobItem.Status < SyncJobItemStatus.ReadyToTransfer)
            {
                throw new ArgumentException("The job item is not yet ready for transfer.");
            }

            var task = _syncManager.ReportSyncJobItemTransferBeginning(request.Id);

            Task.WaitAll(task);

            return(ToStaticFileResult(jobItem.OutputPath));
        }