From dc0bb05c3efbe7529f176c02fb76b0a9d4b85552 Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Tue, 9 Nov 2021 10:35:10 -0600 Subject: [PATCH 1/2] Cross-link Blazor section to What's New (#23819) --- aspnetcore/migration/50-to-60.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/migration/50-to-60.md b/aspnetcore/migration/50-to-60.md index b8fbf66cb2..b980c4709c 100644 --- a/aspnetcore/migration/50-to-60.md +++ b/aspnetcore/migration/50-to-60.md @@ -196,7 +196,7 @@ We expect library authors to continue targeting `IHostBuilder`, `IWebHostBuilder ## Blazor -To adopt all of the new 6.0 features for Blazor apps, we recommend the following process: +To adopt all of the [new 6.0 features for Blazor apps](xref:aspnetcore-6.0#blazor), we recommend the following process: * Create a new 6.0 Blazor project from one of the Blazor project templates. For more information, see . * Move the app's components and code to the 6.0 app making modifications to adopt the new 6.0 features. From 243d9a82dc139c678e540e90ae19e849f750e0d1 Mon Sep 17 00:00:00 2001 From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> Date: Tue, 9 Nov 2021 07:06:43 -1000 Subject: [PATCH 2/2] fix min web API todo /2 (#23820) * fix min web API todo /2 * fix min web API todo /2 --- aspnetcore/tutorials/min-web-api.md | 2 +- .../tutorials/min-web-api/samples/6.x/todoDTO/Program.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/aspnetcore/tutorials/min-web-api.md b/aspnetcore/tutorials/min-web-api.md index 000444dd47..e1ae976d9f 100644 --- a/aspnetcore/tutorials/min-web-api.md +++ b/aspnetcore/tutorials/min-web-api.md @@ -419,7 +419,7 @@ A DTO may be used to: To demonstrate the DTO approach, update the `Todo` class to include a secret field: -[!code-csharp[](min-web-api/samples/6.x/todoDTO/Program.cs?name=snippet_secret&highlight=7)] +[!code-csharp[](min-web-api/samples/6.x/todoDTO/Program.cs?name=snippet_secret&highlight=6)] The secret field needs to be hidden from this app, but an administrative app could choose to expose it. diff --git a/aspnetcore/tutorials/min-web-api/samples/6.x/todoDTO/Program.cs b/aspnetcore/tutorials/min-web-api/samples/6.x/todoDTO/Program.cs index e1be293d97..5c8b75a1ba 100644 --- a/aspnetcore/tutorials/min-web-api/samples/6.x/todoDTO/Program.cs +++ b/aspnetcore/tutorials/min-web-api/samples/6.x/todoDTO/Program.cs @@ -28,7 +28,7 @@ app.MapPost("/todoitems", async (TodoItemDTO todoItemDTO, TodoDb db) => db.Todos.Add(todoItem); await db.SaveChangesAsync(); - return Results.Created($"/todoitems/{todoItem.Id}", todoItem); + return Results.Created($"/todoitems/{todoItem.Id}", new TodoItemDTO(todoItem)); }); #region snippet_put @@ -53,7 +53,7 @@ app.MapDelete("/todoitems/{id}", async (int id, TodoDb db) => { db.Todos.Remove(todo); await db.SaveChangesAsync(); - return Results.Ok(todo); + return Results.Ok(new TodoItemDTO(todo)); } return Results.NotFound(); @@ -74,6 +74,7 @@ public class Todo #region snippet_DTO public class TodoItemDTO { + public int Id { get; set; } public string? Name { get; set; } public bool IsComplete { get; set; }