Пример #1
0
        public async Task <IHttpActionResult> Get(string name, [FromUri] Guid deploymentId, [FromUri] bool includeFiles = false)
        {
            try
            {
                var applicationTask       = applicationRepository.GetApplicationAsync(name);
                var activeDeploymentsTask = deploymentRepository.GetDeploymentAsync(deploymentId);
                await Task.WhenAll(applicationTask, activeDeploymentsTask);

                if (applicationTask.Result == null)
                {
                    return(BadRequest("Application " + name + " was not found."));
                }
                if (activeDeploymentsTask.Result == null)
                {
                    return(NotFound());
                }
                var deployment = activeDeploymentsTask.Result;
                if (!includeFiles)
                {
                    deployment.FileHashes = null;
                }
                return(Ok(activeDeploymentsTask.Result));
            }
            catch (Exception ex)
            {
                Log.Error("Error in deployment controller:", ex);
                return(InternalServerError());
            }
        }