diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/TenantApiController.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/TenantApiController.cs index 3dd94882e39..599b24f5597 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/TenantApiController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/TenantApiController.cs @@ -295,7 +295,7 @@ public async Task Remove(string tenantName) [HttpPost] [Route("setup")] - public async Task Setup(SetupApiViewModel model, [FromForm] IFormFile recipe = null) + public async Task Setup(SetupApiViewModel model) { if (!_currentShellSettings.IsDefaultShell()) { @@ -393,17 +393,14 @@ public async Task Setup(SetupApiViewModel model, [FromForm] IFormF if (string.IsNullOrEmpty(recipeName)) { - if (recipe == null) + if (model.Recipe == null) { return BadRequest(S["Either a 'recipe' file or 'RecipeName' is required."]); } var tempFilename = Path.GetTempFileName(); - using (var fs = System.IO.File.Create(tempFilename)) - { - await recipe.CopyToAsync(fs); - } + await System.IO.File.WriteAllTextAsync(tempFilename, model.Recipe); var fileProvider = new PhysicalFileProvider(Path.GetDirectoryName(tempFilename)); diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/ViewModels/SetupApiViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/ViewModels/SetupApiViewModel.cs index 7a7e8ecaf54..6f92cb165aa 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/ViewModels/SetupApiViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/ViewModels/SetupApiViewModel.cs @@ -25,8 +25,16 @@ public class SetupApiViewModel [DataType(DataType.Password)] public string Password { get; set; } + /// + /// The name of a recipe available in the app. + /// public string RecipeName { get; set; } + /// + /// A JSON string representing a custom recipe. + /// + public string Recipe { get; set; } + public string SiteTimeZone { get; set; } public string Schema { get; set; }