Пример #1
0
        public async Task <IHttpActionResult> Get(string name, string serverName = null, [FromUri] bool includeInactive = false, [FromUri] bool includeFiles = false)
        {
            try
            {
                var applicationTask       = applicationRepository.GetApplicationAsync(name);
                var activeDeploymentsTask = includeInactive
                    ? deploymentRepository.GetAllDeploymentsAsync(name, serverName)
                    : deploymentRepository.GetActiveDeploymentsAsync(name, serverName);
                await Task.WhenAll(applicationTask, activeDeploymentsTask);

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