in Webapp/SDAF/Controllers/LandscapeController.cs [182:216]
public async Task<IActionResult> CreateAsync(LandscapeModel landscape)
{
if (ModelState.IsValid || landscape.IsDefault)
{
try
{
if (landscape.IsDefault)
{
await UnsetDefault(landscape.Id);
}
landscape.Id = Helper.GenerateId(landscape);
DateTime currentDateAndTime = DateTime.Now;
landscape.LastModified = currentDateAndTime.ToShortDateString();
landscape.subscription_id = landscape.subscription.Replace("/subscriptions/", "");
await _landscapeService.CreateAsync(new LandscapeEntity(landscape));
TempData["success"] = "Successfully created workload zone " + landscape.Id;
string id = landscape.Id;
string path = $"/LANDSCAPE/{id}/{id}.tfvars";
string content = Helper.ConvertToTerraform(landscape);
return RedirectToAction("Index");
}
catch (Exception e)
{
ModelState.AddModelError("LandscapeId", "Error creating workload zone: " + e.Message);
}
}
landscapeView.SapObject = landscape;
ViewBag.ValidImageOptions = (imagesOffered.Length != 0);
ViewBag.ImageOptions = imageOptions;
return View(landscapeView);
}