public async Task CreateAsync()

in Webapp/SDAF/Controllers/FileController.cs [198:229]


        public async Task<IActionResult> CreateAsync(string id, string fileContent, string templateName, string sourceController)
        {
            try
            {
                byte[] bytes = Encoding.UTF8.GetBytes(fileContent);

                AppFile file = new()
                {
                    Id = WebUtility.HtmlEncode(id),
                    Content = bytes,
                    UntrustedName = id,
                    Size = bytes.Length,
                    UploadDT = DateTime.UtcNow
                };

                await _appFileService.CreateAsync(file);

                TempData["success"] = "Successfully created file " + id;

                return RedirectToAction("Index", sourceController);
            }
            catch (Exception e)
            {
                ModelState.AddModelError("FileId", "Error creating file: " + e.Message);
            }

            ViewBag.TemplateName = templateName;
            ViewBag.Message = fileContent;
            ViewBag.SourceController = sourceController;
            return View();

        }