diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/ApiClient.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/ApiClient.mustache index 3e21a800e08e..e874041b3e7c 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/ApiClient.mustache @@ -327,9 +327,9 @@ namespace {{packageName}}.Client var bytes = ClientUtils.ReadAsBytes(fileParam.Value); var fileStream = fileParam.Value as FileStream; if (fileStream != null) - FileParameter.Create(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name)); + request.Files.Add(FileParameter.Create(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name))); else - FileParameter.Create(fileParam.Key, bytes, "no_file_name_provided"); + request.Files.Add(FileParameter.Create(fileParam.Key, bytes, "no_file_name_provided")); } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs index 4d946eca6a89..19b7a6c81baa 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs @@ -279,11 +279,11 @@ public void UploadFileTest() Stream _imageStream = _assembly.GetManifestResourceStream("Org.OpenAPITools.Test.linux-logo.png"); PetApi petApi = new PetApi(); // test file upload with form parameters - //petApi.UploadFile(petId, "new form name", _imageStream); + petApi.UploadFile(petId, "new form name", _imageStream); // test file upload without any form parameters // using optional parameter syntax introduced at .net 4.0 - //petApi.UploadFile(petId: petId, file: _imageStream); + petApi.UploadFile(petId: petId, file: _imageStream); } /// diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs index f500f1e5b9e2..0071562ed269 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs @@ -330,9 +330,9 @@ private RestRequest newRequest( var bytes = ClientUtils.ReadAsBytes(fileParam.Value); var fileStream = fileParam.Value as FileStream; if (fileStream != null) - FileParameter.Create(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name)); + request.Files.Add(FileParameter.Create(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name))); else - FileParameter.Create(fileParam.Key, bytes, "no_file_name_provided"); + request.Files.Add(FileParameter.Create(fileParam.Key, bytes, "no_file_name_provided")); } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs index 12d3d49f7386..f68650fa7bc9 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -331,9 +331,9 @@ private RestRequest newRequest( var bytes = ClientUtils.ReadAsBytes(fileParam.Value); var fileStream = fileParam.Value as FileStream; if (fileStream != null) - FileParameter.Create(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name)); + request.Files.Add(FileParameter.Create(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name))); else - FileParameter.Create(fileParam.Key, bytes, "no_file_name_provided"); + request.Files.Add(FileParameter.Create(fileParam.Key, bytes, "no_file_name_provided")); } }