From 6aee28fd8614920b5d36f2cfb99a8159cc46b261 Mon Sep 17 00:00:00 2001 From: Diego Sousa Date: Mon, 15 Apr 2024 17:03:06 -0300 Subject: [PATCH] fix: Adjust to PostTodoItem in firstwebapi files (#32326) --- .../tutorials/first-web-api/includes/first-web-api3-7.md | 2 +- .../samples/2.2/TodoApi/Controllers/TodoController.cs | 2 +- .../samples/3.0/TodoApi/Controllers/TodoItemsController.cs | 4 ++-- .../samples/5.x/TodoApi/Controllers/TodoItemsController.cs | 4 ++-- .../samples/6.0/TodoApi/Controllers/TodoItemsController.cs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/aspnetcore/tutorials/first-web-api/includes/first-web-api3-7.md b/aspnetcore/tutorials/first-web-api/includes/first-web-api3-7.md index a67a65e365..3797a36341 100644 --- a/aspnetcore/tutorials/first-web-api/includes/first-web-api3-7.md +++ b/aspnetcore/tutorials/first-web-api/includes/first-web-api3-7.md @@ -344,7 +344,7 @@ The method: * Returns an [HTTP 201 status code](https://developer.mozilla.org/docs/Web/HTTP/Status/201) if successful. `HTTP 201` is the standard response for an `HTTP POST` method that creates a new resource on the server. * Adds a [Location](https://developer.mozilla.org/docs/Web/HTTP/Headers/Location) header to the response. The `Location` header specifies the [URI](https://developer.mozilla.org/docs/Glossary/URI) of the newly created to-do item. For more information, see [10.2.2 201 Created](https://www.rfc-editor.org/rfc/rfc9110.html#section-10.2.2). -* References the `GetTodoItem` action to create the `Location` header's URI. The C# `nameof` keyword is used to avoid hard-coding the action name in the `CreatedAtAction` call. +* References the `PostTodoItem` action to create the `Location` header's URI. The C# `nameof` keyword is used to avoid hard-coding the action name in the `CreatedAtAction` call. diff --git a/aspnetcore/tutorials/first-web-api/samples/2.2/TodoApi/Controllers/TodoController.cs b/aspnetcore/tutorials/first-web-api/samples/2.2/TodoApi/Controllers/TodoController.cs index 31366d02cf..ea1d1fba92 100644 --- a/aspnetcore/tutorials/first-web-api/samples/2.2/TodoApi/Controllers/TodoController.cs +++ b/aspnetcore/tutorials/first-web-api/samples/2.2/TodoApi/Controllers/TodoController.cs @@ -63,7 +63,7 @@ namespace TodoApi.Controllers _context.TodoItems.Add(item); await _context.SaveChangesAsync(); - return CreatedAtAction(nameof(GetTodoItem), new { id = item.Id }, item); + return CreatedAtAction(nameof(PostTodoItem), new { id = item.Id }, item); } #endregion diff --git a/aspnetcore/tutorials/first-web-api/samples/3.0/TodoApi/Controllers/TodoItemsController.cs b/aspnetcore/tutorials/first-web-api/samples/3.0/TodoApi/Controllers/TodoItemsController.cs index d3c6dc578e..41803bbce2 100644 --- a/aspnetcore/tutorials/first-web-api/samples/3.0/TodoApi/Controllers/TodoItemsController.cs +++ b/aspnetcore/tutorials/first-web-api/samples/3.0/TodoApi/Controllers/TodoItemsController.cs @@ -85,8 +85,8 @@ namespace TodoApi.Controllers _context.TodoItems.Add(todoItem); await _context.SaveChangesAsync(); - //return CreatedAtAction("GetTodoItem", new { id = todoItem.Id }, todoItem); - return CreatedAtAction(nameof(GetTodoItem), new { id = todoItem.Id }, todoItem); + //return CreatedAtAction("PostTodoItem", new { id = todoItem.Id }, todoItem); + return CreatedAtAction(nameof(PostTodoItem), new { id = todoItem.Id }, todoItem); } #endregion diff --git a/aspnetcore/tutorials/first-web-api/samples/5.x/TodoApi/Controllers/TodoItemsController.cs b/aspnetcore/tutorials/first-web-api/samples/5.x/TodoApi/Controllers/TodoItemsController.cs index 62331b7751..69d7aa9e0e 100644 --- a/aspnetcore/tutorials/first-web-api/samples/5.x/TodoApi/Controllers/TodoItemsController.cs +++ b/aspnetcore/tutorials/first-web-api/samples/5.x/TodoApi/Controllers/TodoItemsController.cs @@ -85,8 +85,8 @@ namespace TodoApi.Controllers _context.TodoItems.Add(todoItem); await _context.SaveChangesAsync(); - //return CreatedAtAction("GetTodoItem", new { id = todoItem.Id }, todoItem); - return CreatedAtAction(nameof(GetTodoItem), new { id = todoItem.Id }, todoItem); + //return CreatedAtAction("PostTodoItem", new { id = todoItem.Id }, todoItem); + return CreatedAtAction(nameof(PostTodoItem), new { id = todoItem.Id }, todoItem); } #endregion diff --git a/aspnetcore/tutorials/first-web-api/samples/6.0/TodoApi/Controllers/TodoItemsController.cs b/aspnetcore/tutorials/first-web-api/samples/6.0/TodoApi/Controllers/TodoItemsController.cs index bb93f8c9dd..ba599cb1a2 100644 --- a/aspnetcore/tutorials/first-web-api/samples/6.0/TodoApi/Controllers/TodoItemsController.cs +++ b/aspnetcore/tutorials/first-web-api/samples/6.0/TodoApi/Controllers/TodoItemsController.cs @@ -87,8 +87,8 @@ namespace TodoApi.Controllers _context.TodoItems.Add(todoItem); await _context.SaveChangesAsync(); - //return CreatedAtAction("GetTodoItem", new { id = todoItem.Id }, todoItem); - return CreatedAtAction(nameof(GetTodoItem), new { id = todoItem.Id }, todoItem); + //return CreatedAtAction("PostTodoItem", new { id = todoItem.Id }, todoItem); + return CreatedAtAction(nameof(PostTodoItem), new { id = todoItem.Id }, todoItem); } #endregion