Esempio n. 1
0
        private async Task <IReadOnlyCollection <ListDeploymentViewModel> > GetDeploymentList(Server server)
        {
            IReadOnlyCollection <Deployment> deployments = await _deploymentService.GetDeployments(server.Name);

            List <ListDeploymentViewModel> viewModels = new List <ListDeploymentViewModel>();

            foreach (Deployment deployment in deployments)
            {
                viewModels.Add(new ListDeploymentViewModel
                {
                    BuildPath  = deployment.BuildPath,
                    Id         = deployment.Id,
                    LastBackup = !string.IsNullOrEmpty(server.Paths.Backup) ? await _remoteService.GetLastBackup(deployment.Id) : null,
                    LastUpload = !string.IsNullOrEmpty(server.Paths.Deploy) ? await _remoteService.GetLastUpload(deployment.Id) : null,
                    Name       = deployment.Name,
                    Offline    = !string.IsNullOrEmpty(deployment.OfflineFile) ? await _remoteService.IsOffline(deployment.Id) : default(bool?),
                    RemotePath = deployment.RemotePath
                });
            }

            return(viewModels);
        }