From c7be0f94c4d61862496fdc4cb2591ffd2ff20dc3 Mon Sep 17 00:00:00 2001 From: Julia Kulla-Mader Date: Tue, 26 Apr 2022 03:58:03 -0400 Subject: [PATCH] Updates for .NET 6. Ran successfully locally (#333) --- .../Application/SampleFunctionApp/Function1.cs | 8 +++++--- .../SampleFunctionApp/SampleFunctionApp.csproj | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dotnet/aspnetcore/functionApp/Application/SampleFunctionApp/Function1.cs b/dotnet/aspnetcore/functionApp/Application/SampleFunctionApp/Function1.cs index 128a2e1e3..a10e584a1 100644 --- a/dotnet/aspnetcore/functionApp/Application/SampleFunctionApp/Function1.cs +++ b/dotnet/aspnetcore/functionApp/Application/SampleFunctionApp/Function1.cs @@ -25,9 +25,11 @@ public static async Task Run( dynamic data = JsonConvert.DeserializeObject(requestBody); name = name ?? data?.name; - return name != null - ? (ActionResult)new OkObjectResult($"Hello {name}! Welcome to Azure Functions!") - : (ActionResult)new OkObjectResult("Hello there! Welcome to Azure Functions!"); + string responseMessage = string.IsNullOrEmpty(name) + ? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response." + : $"Hello, {name}. This HTTP triggered function executed successfully."; + + return new OkObjectResult(responseMessage); } } } diff --git a/dotnet/aspnetcore/functionApp/Application/SampleFunctionApp/SampleFunctionApp.csproj b/dotnet/aspnetcore/functionApp/Application/SampleFunctionApp/SampleFunctionApp.csproj index 4703c35c3..986f94801 100644 --- a/dotnet/aspnetcore/functionApp/Application/SampleFunctionApp/SampleFunctionApp.csproj +++ b/dotnet/aspnetcore/functionApp/Application/SampleFunctionApp/SampleFunctionApp.csproj @@ -1,10 +1,10 @@ - netcoreapp2.1 - v2 + net6.0 + v4 - + @@ -15,4 +15,4 @@ Never - \ No newline at end of file +