public async Task DeployConfirmedAsync()

in Webapp/SDAF/Controllers/SystemController.cs [247:323]


        public async Task<RedirectToActionResult> DeployConfirmedAsync(string id, string partitionKey, Templateparameters parameters)
        {
            try
            {
                SystemModel system = await GetById(id, partitionKey);

                AppFile file = null;
                try
                {
                    file = await _appFileService.GetByIdAsync(id + "_custom_naming.json", partitionKey);
                    system.name_override_file = id + "_custom_naming.json";
                    var stream = new MemoryStream(file.Content);

                    string thisContent = System.Text.Encoding.UTF8.GetString(stream.ToArray());
                    string pathForNaming = $"/SYSTEM/{id}/{id}_custom_naming.json";

                    await restHelper.UpdateRepo(pathForNaming, thisContent);
                }
                catch
                {

                }

                file = null;
                try
                {
                    file = await _appFileService.GetByIdAsync(id + "_custom_sizes.json", partitionKey);
                    var stream = new MemoryStream(file.Content);

                    system.custom_disk_sizes_filename = id + "_custom_sizes.json";
                    system.database_size = "Custom";

                    string thisContent = System.Text.Encoding.UTF8.GetString(stream.ToArray());
                    string pathForNaming = $"/SYSTEM/{id}/{id}_custom_sizes.json";

                    await restHelper.UpdateRepo(pathForNaming, thisContent);
                }
                catch
                {

                }

                string path = $"/SYSTEM/{id}/{id}.tfvars";
                system.subscription_id = system.subscription.Replace("/subscriptions/", "");
                string content = Helper.ConvertToTerraform(system);

                await restHelper.UpdateRepo(path, content);


                string pipelineId = _configuration["SYSTEM_PIPELINE_ID"];
                string branch = _configuration["SourceBranch"];
                parameters.sap_system = id;
                PipelineRequestBody requestBody = new()
                {
                    resources = new Resources
                    {
                        repositories = new Repositories
                        {
                            self = new Self
                            {
                                refName = $"refs/heads/{branch}"
                            }
                        }
                    },
                    templateParameters = parameters
                };

                await restHelper.TriggerPipeline(pipelineId, requestBody);

                TempData["success"] = "Successfully triggered system deployment pipeline for " + id;
            }
            catch (Exception e)
            {
                TempData["error"] = "Error deploying system " + id + ": " + e.Message;
            }
            return RedirectToAction("Index");
        }