You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/tutorials/first-web-api.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -266,9 +266,9 @@ The *database context* is the main class that coordinates Entity Framework funct
266
266
267
267
In ASP.NET Core, services such as the DB context must be registered with the [dependency injection (DI)](xref:fundamentals/dependency-injection) container. The container provides the service to controllers.
268
268
269
-
Update `Program.cs` with the following highlighted code:
269
+
*Update `Program.cs` with the following highlighted code:
@@ -348,9 +348,9 @@ When the `[action]` token isn't in the route template, the [action](xref:mvc/con
348
348
349
349
## Update the PostTodoItem create method
350
350
351
-
In **Controllers/TodoItemsController.cs** update the return statement in the `PostTodoItem` to use the [nameof](/dotnet/csharp/language-reference/operators/nameof) operator:
351
+
*In **Controllers/TodoItemsController.cs** update the return statement in the `PostTodoItem` to use the [nameof](/dotnet/csharp/language-reference/operators/nameof) operator:
The preceding code is an `HTTP POST` method, as indicated by the [`[HttpPost]`](xref:Microsoft.AspNetCore.Mvc.HttpPostAttribute) attribute. The method gets the value of the `TodoItem` from the body of the HTTP request.
356
356
@@ -401,7 +401,7 @@ Two GET endpoints are implemented:
401
401
402
402
The previous section showed an example of the `/api/todoitems/{id}` route.
403
403
404
-
Follow the [POST](#post7) instructions to add another todo item, and then test the `/api/todoitems` route using Swagger.
404
+
*Follow the [POST](#post7) instructions to add another todo item, and then test the `/api/todoitems` route using Swagger.
405
405
406
406
This app uses an in-memory database. If the app is stopped and started, the preceding GET request doesn't return any data. If no data is returned, [POST](#post7) data to the app.
407
407
@@ -442,7 +442,7 @@ Examine the `PutTodoItem` method:
442
442
443
443
This sample uses an in-memory database that must be initialized each time the app is started. There must be an item in the database before you make a PUT call. Call GET to ensure there's an item in the database before making a PUT call.
444
444
445
-
Using the Swagger UI, use the PUT button to update the `TodoItem` that has Id = 1 and set its name to `"feed fish"`. Note the response is [`HTTP 204 No Content`](https://developer.mozilla.org/docs/Web/HTTP/Status/204).
445
+
*Using the Swagger UI, use the PUT button to update the `TodoItem` that has Id = 1 and set its name to `"feed fish"`. Note the response is [`HTTP 204 No Content`](https://developer.mozilla.org/docs/Web/HTTP/Status/204).
446
446
447
447
## The DeleteTodoItem method
448
448
@@ -452,7 +452,7 @@ Examine the `DeleteTodoItem` method:
452
452
453
453
### Test the DeleteTodoItem method
454
454
455
-
Use the Swagger UI to delete the `TodoItem` that has Id = 1. Note the response is [`HTTP 204 No Content`](https://developer.mozilla.org/docs/Web/HTTP/Status/204).
455
+
*Use the Swagger UI to delete the `TodoItem` that has Id = 1. Note the response is [`HTTP 204 No Content`](https://developer.mozilla.org/docs/Web/HTTP/Status/204).
456
456
457
457
## Test with other tools
458
458
@@ -482,7 +482,7 @@ A DTO may be used to:
482
482
* Omit some properties in order to reduce payload size.
483
483
* Flatten object graphs that contain nested objects. Flattened object graphs can be more convenient for clients.
484
484
485
-
To demonstrate the DTO approach, update the `TodoItem` class to include a secret field:
485
+
*To demonstrate the DTO approach, update the `TodoItem` class to include a secret field:
0 commit comments