Apphbify.SecuredPagesModule.DoDeploy C# (CSharp) Метод

DoDeploy() приватный Метод

private DoDeploy ( dynamic parameters ) : dynamic
parameters dynamic
Результат dynamic
        private dynamic DoDeploy(dynamic parameters)
        {
            var app = _Data.GetAppByKey((string)parameters.key);
            if (app == null) return Response.AsRedirect("/Apps").WithErrorFlash(Session, String.Format("App {0} not found.", (string)parameters.key));
            if (!Request.Form.application_name.HasValue) return Response.AsRedirect("/Deploy/" + app.Key).WithErrorFlash(Session, "Please enter an application name");
            if (!Request.Form.region_id.HasValue || !_Data.DoesRegionExist(Request.Form.region_id)) return Response.AsRedirect("/Deploy/" + app.Key).WithErrorFlash(Session, "Please choose a valid deployment region");

            string appName = Request.Form.application_name;
            string region_id = Request.Form.region_id;
            string slug = "";

            // Build set of variables that need to be added to the application
            var variables = new Dictionary<string, string>();
            foreach (var variable in app.Variables)
            {
                if (Request.Form[variable.Key].HasValue)
                    variables.Add(variable.Key, Request.Form[variable.Key]);
            }
            foreach (var variable in app.DefaultVariables)
            {
                variables.Add(variable.Key, this.ParseDefaultValue(variable.Value));
            }

            var result = _Deploy.Deploy(appName, region_id, app, variables, out slug);

            // TODO: Log errors here, we want to know whether the API or the app config is at fault.
            switch (result)
            {
                case DeploymentResult.UnableToCreateApplication:
                    return Response.AsRedirect("/Deploy/" + app.Key).WithErrorFlash(Session, "There was a problem creating the application at AppHarbor.");
                case DeploymentResult.UnableToDeployCode:
                    return Response.AsRedirect("/Deploy/" + app.Key).WithErrorFlash(Session, "There was a problem deploying the application.");
                case DeploymentResult.ErrorInstallingAddons:
                    return Response.AsRedirect("/Sites").WithErrorFlash(Session, "Your site has been deployed but there were problems installing all required addons. The site may not operate as expected.");
                case DeploymentResult.ErrorSettingVariables:
                    return Response.AsRedirect("/Sites").WithErrorFlash(Session, "Your site has been deployed but there were problems setting all the configuration variables. The site may not operate as expected, please log in to AppHarbor to confirm.");
                case DeploymentResult.Success:
                    return Response.AsRedirect("/Sites").WithSuccessFlash(Session, String.Format("{0} deployed into site {1} ({2})", app.Name, appName, slug));
                default:
                    return Response.AsRedirect("/Deploy/" + app.Key).WithErrorFlash(Session, "There was a problem deploying the application. Double check your deployed application to see whether it was successful or not");
            }
        }