From c5985fec591b7d8ef0f135e6e8eff8da3d861894 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 14 Oct 2026 16:23:20 -0700 Subject: [PATCH 1/3] Modify markdown links verifier config Updated the excludeStartingWith list to include '~/../'. --- aspnetcore/markdown-links-verifier-config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/markdown-links-verifier-config.json b/aspnetcore/markdown-links-verifier-config.json index 6ec07132bf65..570a256e8d20 100644 --- a/aspnetcore/markdown-links-verifier-config.json +++ b/aspnetcore/markdown-links-verifier-config.json @@ -1,7 +1,7 @@ { "excludeStartingWith": [ "xref:", - "~/", + "~/../", "/", "#-", "?view", From aad1b17801fb1a7d326440ddf10e8f4e0894ed65 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Thu, 15 Oct 2026 18:14:00 -0700 Subject: [PATCH 2/3] Update docs-verifier action version --- .github/workflows/docs-verifier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs-verifier.yml b/.github/workflows/docs-verifier.yml index 391f5b948ea3..8518784a7f44 100644 --- a/.github/workflows/docs-verifier.yml +++ b/.github/workflows/docs-verifier.yml @@ -18,7 +18,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Validate - uses: dotnet/docs-actions/docs-verifier@ee93453f8ce383d3fdf0d1028ea57ba88ea2ad24 # main + uses: dotnet/docs-actions/docs-verifier@0423860a660ff661db5dbfef394d3f6da721d4c0 # main env: GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a8dc37da47be3aec8ca37d8718762a82f623bead Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Thu, 15 Oct 2026 18:39:30 -0700 Subject: [PATCH 3/3] Fix link case sensitivity issues --- aspnetcore/grpc/json-transcoding.md | 4 +-- .../includes/json-transcoding7.md | 9 +++++-- aspnetcore/includes/trustCertMac6.md | 4 +-- .../first-mvc-app/adding-controller.md | 6 ++--- .../includes/adding-controller8.md | 9 +++++-- .../includes/adding-controller9.md | 9 +++++-- .../tutorials/first-mvc-app/adding-model.md | 4 +-- .../adding-model/includes/adding-model7.md | 21 ++++++++++------ .../adding-model/includes/adding-model8.md | 9 +++++-- .../adding-model/includes/adding-model9.md | 9 +++++-- .../tutorials/first-mvc-app/adding-view.md | 6 ++--- .../adding-view/includes/adding-view8.md | 9 +++++-- .../adding-view/includes/adding-view9.md | 9 +++++-- .../first-mvc-app/controller-methods-views.md | 2 +- .../includes/controller-methods-views8.md | 7 +++++- .../includes/controller-methods-views9.md | 7 +++++- aspnetcore/tutorials/first-mvc-app/details.md | 6 ++--- .../details/includes/details8.md | 11 +++++--- .../details/includes/details9.md | 11 +++++--- .../tutorials/first-mvc-app/new-field.md | 2 +- .../new-field/includes/new-field8.md | 7 +++++- .../new-field/includes/new-field9.md | 9 +++++-- aspnetcore/tutorials/first-mvc-app/search.md | 20 +++++++-------- .../first-mvc-app/search/includes/search8.md | 25 +++++++++++-------- .../first-mvc-app/search/includes/search9.md | 25 +++++++++++-------- .../start-mvc/includes/start-mvc5.md | 7 +++++- .../start-mvc/includes/start-mvc6.md | 7 +++++- .../start-mvc/includes/start-mvc7.md | 7 +++++- .../start-mvc/includes/start-mvc8.md | 9 +++++-- .../start-mvc/includes/start-mvc9.md | 7 +++++- .../tutorials/first-mvc-app/validation.md | 2 +- .../validation/includes/validation8.md | 9 +++++-- .../validation/includes/validation9.md | 9 +++++-- .../first-mvc-app/working-with-sql.md | 4 +-- .../includes/working-with-sql3-5.md | 7 +++++- .../includes/working-with-sql6.md | 7 +++++- .../includes/working-with-sql7.md | 7 +++++- .../includes/working-with-sql8.md | 9 +++++-- .../includes/working-with-sql9.md | 9 +++++-- .../razor-pages/model/includes/model5.md | 7 +++++- 40 files changed, 246 insertions(+), 101 deletions(-) diff --git a/aspnetcore/grpc/json-transcoding.md b/aspnetcore/grpc/json-transcoding.md index cde601962873..727e913e6fe5 100644 --- a/aspnetcore/grpc/json-transcoding.md +++ b/aspnetcore/grpc/json-transcoding.md @@ -43,7 +43,7 @@ gRPC can still be used to call services. 1. Annotate gRPC methods in your `.proto` files with HTTP bindings and routes: - [!code-protobuf[](~/grpc/json-transcoding/samples/8/GrpcServiceTranscoding/protos/greet.proto?highlight=4,11-13)] + [!code-protobuf[](~/grpc/json-transcoding/samples/8/GrpcServiceTranscoding/Protos/greet.proto?highlight=4,11-13)] The `SayHello` gRPC method can now be invoked as gRPC and as a JSON Web API: @@ -69,7 +69,7 @@ info: Microsoft.AspNetCore.Hosting.Diagnostics[2] gRPC methods must be annotated with an HTTP rule before they support transcoding. The HTTP rule includes information about how to call the gRPC method, such as the HTTP method and route. -[!code-protobuf[](~/grpc/json-transcoding/samples/8/GrpcServiceTranscoding/protos/greet.proto?highlight=3-5&range=9-15)] +[!code-protobuf[](~/grpc/json-transcoding/samples/8/GrpcServiceTranscoding/Protos/greet.proto?highlight=3-5&range=9-15)] The proceeding example: diff --git a/aspnetcore/grpc/json-transcoding/includes/json-transcoding7.md b/aspnetcore/grpc/json-transcoding/includes/json-transcoding7.md index 8706c259449f..411fac12e18f 100644 --- a/aspnetcore/grpc/json-transcoding/includes/json-transcoding7.md +++ b/aspnetcore/grpc/json-transcoding/includes/json-transcoding7.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-7.0" [gRPC](https://grpc.io) is a high-performance Remote Procedure Call (RPC) framework. gRPC uses HTTP/2, streaming, Protobuf, and message contracts to create high-performance, real-time services. @@ -27,7 +32,7 @@ gRPC can still be used to call services. 1. Add [`google/api/http.proto`](https://github.com/dotnet/aspnetcore/blob/main/src/Grpc/JsonTranscoding/test/testassets/Sandbox/google/api/http.proto) and [`google/api/annotations.proto`](https://github.com/dotnet/aspnetcore/blob/main/src/Grpc/JsonTranscoding/test/testassets/Sandbox/google/api/annotations.proto) files to the `/google/api` directory. 1. Annotate gRPC methods in your `.proto` files with HTTP bindings and routes: -[!code-protobuf[](~/grpc/json-transcoding/samples/7/GrpcServiceTranscoding/protos/greet.proto?highlight=4,11-13)] +[!code-protobuf[](~/grpc/json-transcoding/samples/7/GrpcServiceTranscoding/Protos/greet.proto?highlight=4,11-13)] The `SayHello` gRPC method can now be invoked as gRPC and as a JSON Web API: @@ -53,7 +58,7 @@ info: Microsoft.AspNetCore.Hosting.Diagnostics[2] gRPC methods must be annotated with an HTTP rule before they support transcoding. The HTTP rule includes information about how to call the gRPC method, such as the HTTP method and route. -[!code-protobuf[](~/grpc/json-transcoding/samples/7/GrpcServiceTranscoding/protos/greet.proto?highlight=3-5&range=9-15)] +[!code-protobuf[](~/grpc/json-transcoding/samples/7/GrpcServiceTranscoding/Protos/greet.proto?highlight=3-5&range=9-15)] The proceeding example: diff --git a/aspnetcore/includes/trustCertMac6.md b/aspnetcore/includes/trustCertMac6.md index 093947f0d864..025a7c23ad73 100644 --- a/aspnetcore/includes/trustCertMac6.md +++ b/aspnetcore/includes/trustCertMac6.md @@ -1,12 +1,12 @@ Visual Studio for Mac displays the following popup: -![HTTPS Development certificate not found. Do you want to install and trust the certificate?](~/static/trustCertMac6.png) +![HTTPS Development certificate not found. Do you want to install and trust the certificate?](~/static/trustcertmac6.png) Select **Install and Trust** if you trust the development certificate. The following dialog is displayed: -![Security warning dialog](~/static/certMac6.png) +![Security warning dialog](~/static/certmac6.png) Enter your password and select **Update Settings** diff --git a/aspnetcore/tutorials/first-mvc-app/adding-controller.md b/aspnetcore/tutorials/first-mvc-app/adding-controller.md index 965035def01d..27e9b9370709 100644 --- a/aspnetcore/tutorials/first-mvc-app/adding-controller.md +++ b/aspnetcore/tutorials/first-mvc-app/adding-controller.md @@ -2,8 +2,8 @@ title: Part 2, add a controller to an ASP.NET Core MVC app ai-usage: ai-assisted description: Part 2 of tutorial series on ASP.NET Core MVC. -ms.date: 09/06/2026 monikerRange: '>= aspnetcore-3.1' +ms.date: 09/06/2026 uid: tutorials/first-mvc-app/adding-controller --- @@ -59,7 +59,7 @@ Select the **EXPLORER** icon and then control-click (right-click) **Controllers Replace the contents of `Controllers/HelloWorldController.cs` with the following code: - [!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/HelloWorldController.cs?name=snippet_First)] + [!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/HelloWorldController.cs?name=snippet_First)] Every `public` method in a controller is callable as an HTTP endpoint. In the sample above, both methods return a string. Note the comments preceding each method. @@ -105,7 +105,7 @@ Modify the code to pass some parameter information from the URL to the controlle Change the `Welcome` method to include two parameters as shown in the following code. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/HelloWorldController.cs?name=snippet_Second)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/HelloWorldController.cs?name=snippet_Second)] The preceding code: diff --git a/aspnetcore/tutorials/first-mvc-app/adding-controller/includes/adding-controller8.md b/aspnetcore/tutorials/first-mvc-app/adding-controller/includes/adding-controller8.md index 34a9187d1eae..d440eafd2055 100644 --- a/aspnetcore/tutorials/first-mvc-app/adding-controller/includes/adding-controller8.md +++ b/aspnetcore/tutorials/first-mvc-app/adding-controller/includes/adding-controller8.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-8.0" The Model-View-Controller (MVC) architectural pattern separates an app into three main components: **M**odel, **V**iew, and **C**ontroller. The MVC pattern helps you create apps that are more testable and easier to update than traditional monolithic apps. @@ -46,7 +51,7 @@ Select the **EXPLORER** icon and then control-click (right-click) **Controllers Replace the contents of `Controllers/HelloWorldController.cs` with the following code: - [!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/HelloWorldController.cs?name=snippet_First)] + [!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/HelloWorldController.cs?name=snippet_First)] Every `public` method in a controller is callable as an HTTP endpoint. In the sample above, both methods return a string. Note the comments preceding each method. @@ -92,7 +97,7 @@ Modify the code to pass some parameter information from the URL to the controlle Change the `Welcome` method to include two parameters as shown in the following code. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/HelloWorldController.cs?name=snippet_Second)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/HelloWorldController.cs?name=snippet_Second)] The preceding code: diff --git a/aspnetcore/tutorials/first-mvc-app/adding-controller/includes/adding-controller9.md b/aspnetcore/tutorials/first-mvc-app/adding-controller/includes/adding-controller9.md index a7636c192477..9432fd84aeb8 100644 --- a/aspnetcore/tutorials/first-mvc-app/adding-controller/includes/adding-controller9.md +++ b/aspnetcore/tutorials/first-mvc-app/adding-controller/includes/adding-controller9.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-9.0" The Model-View-Controller (MVC) architectural pattern separates an app into three main components: **M**odel, **V**iew, and **C**ontroller. The MVC pattern helps you create apps that are more testable and easier to update than traditional monolithic apps. @@ -46,7 +51,7 @@ Select the **EXPLORER** icon and then control-click (right-click) **Controllers Replace the contents of `Controllers/HelloWorldController.cs` with the following code: - [!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/HelloWorldController.cs?name=snippet_First)] + [!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/HelloWorldController.cs?name=snippet_First)] Every `public` method in a controller is callable as an HTTP endpoint. In the sample above, both methods return a string. Note the comments preceding each method. @@ -92,7 +97,7 @@ Modify the code to pass some parameter information from the URL to the controlle Change the `Welcome` method to include two parameters as shown in the following code. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/HelloWorldController.cs?name=snippet_Second)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/HelloWorldController.cs?name=snippet_Second)] The preceding code: diff --git a/aspnetcore/tutorials/first-mvc-app/adding-model.md b/aspnetcore/tutorials/first-mvc-app/adding-model.md index bda6ed10a602..f3428eea4fbb 100644 --- a/aspnetcore/tutorials/first-mvc-app/adding-model.md +++ b/aspnetcore/tutorials/first-mvc-app/adding-model.md @@ -36,7 +36,7 @@ Add a file named `Movie.cs` to the *Models* folder. Update the `Models/Movie.cs` file with the following code: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Models/Movie.cs?name=snippet_First)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Models/Movie.cs?name=snippet_First)] The `Movie` class contains an `Id` field, which is required by the database for the primary key. @@ -391,7 +391,7 @@ This `@model` directive allows access to the movie that the controller passed to Examine the `Index.cshtml` view and the `Index` method in the Movies controller. Notice how the code creates a `List` object when it calls the `View` method. The code passes this `Movies` list from the `Index` action method to the view: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/MoviesController.cs?name=snippet_FirstIndexNoSearch)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/MoviesController.cs?name=snippet_FirstIndexNoSearch)] The code returns [problem details](xref:fundamentals/error-handling-api#problem-details-service) if the `Movie` property of the data context is null. diff --git a/aspnetcore/tutorials/first-mvc-app/adding-model/includes/adding-model7.md b/aspnetcore/tutorials/first-mvc-app/adding-model/includes/adding-model7.md index 1ba30399c71e..9199df77a137 100644 --- a/aspnetcore/tutorials/first-mvc-app/adding-model/includes/adding-model7.md +++ b/aspnetcore/tutorials/first-mvc-app/adding-model/includes/adding-model7.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-7.0" In this tutorial, classes are added for managing movies in a database. These classes are the "**M**odel" part of the **M**VC app. @@ -372,11 +377,11 @@ Scaffolding added a connection string to the `appsettings.json` file: # [Visual Studio](#tab/visual-studio) -[!code-json[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie70/appsettings.json?highlight=9-10)] +[!code-json[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie70/appsettings.json?highlight=9-10)] # [Visual Studio Code / Visual Studio for Mac](#tab/visual-studio-code+visual-studio-mac) -[!code-json[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie70/appsettings_SQLite.json?highlight=9-10)] +[!code-json[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie70/appsettings_SQLite.json?highlight=9-10)] --- @@ -386,7 +391,7 @@ For local development, the [ASP.NET Core configuration system](xref:fundamentals Examine the `Migrations/{timestamp}_InitialCreate.cs` migration file: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie70/Migrations/20210915202210_InitialCreate.cs)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie70/Migrations/20210915202210_InitialCreate.cs)] In the preceding code: @@ -399,7 +404,7 @@ Open the `Controllers/MoviesController.cs` file and examine the constructor: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie70/Controllers/MoviesController.cs?name=snippet_Constructor)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie70/Controllers/MoviesController.cs?name=snippet_Constructor)] The constructor uses [Dependency Injection](xref:fundamentals/dependency-injection) to inject the database context (`MvcMovieContext`) into the controller. The database context is used in each of the [CRUD](https://wikipedia.org/wiki/Create,_read,_update_and_delete) methods in the controller. @@ -417,7 +422,7 @@ MVC provides the ability to pass strongly typed model objects to a view. This st Examine the generated `Details` method in the `Controllers/MoviesController.cs` file: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie70/Controllers/MoviesController.cs?name=snippet_Details)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie70/Controllers/MoviesController.cs?name=snippet_Details)] The `id` parameter is generally passed as route data. For example, `https://localhost:5001/movies/details/1` sets: @@ -446,7 +451,7 @@ return View(movie); Examine the contents of the `Views/Movies/Details.cshtml` file: -[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie70/Views/Movies/DetailsOriginal.cshtml)] +[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie70/Views/Movies/DetailsOriginal.cshtml)] The `@model` statement at the top of the view file specifies the type of object that the view expects. When the movie controller was created, the following `@model` statement was included: @@ -466,11 +471,11 @@ When the movies controller was created, scaffolding included the following `@mod -[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie70/Views/Movies/IndexOriginal.cshtml?range=1)] +[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie70/Views/Movies/IndexOriginal.cshtml?range=1)] The `@model` directive allows access to the list of movies that the controller passed to the view by using a `Model` object that's strongly typed. For example, in the `Index.cshtml` view, the code loops through the movies with a `foreach` statement over the strongly typed `Model` object: -[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie70/Views/Movies/IndexOriginal.cshtml?highlight=1,31,34,37,40,43,46-48)] +[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie70/Views/Movies/IndexOriginal.cshtml?highlight=1,31,34,37,40,43,46-48)] Because the `Model` object is strongly typed as an `IEnumerable` object, each item in the loop is typed as `Movie`. Among other benefits, the compiler validates the types used in the code. diff --git a/aspnetcore/tutorials/first-mvc-app/adding-model/includes/adding-model8.md b/aspnetcore/tutorials/first-mvc-app/adding-model/includes/adding-model8.md index 6e655ac1b1ac..f325f37f0448 100644 --- a/aspnetcore/tutorials/first-mvc-app/adding-model/includes/adding-model8.md +++ b/aspnetcore/tutorials/first-mvc-app/adding-model/includes/adding-model8.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-8.0" In this tutorial, classes are added for managing movies in a database. These classes are the "**M**odel" part of the **M**VC app. @@ -22,7 +27,7 @@ Add a file named `Movie.cs` to the *Models* folder. Update the `Models/Movie.cs` file with the following code: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Models/Movie.cs?name=snippet_First)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Models/Movie.cs?name=snippet_First)] The `Movie` class contains an `Id` field, which is required by the database for the primary key. @@ -362,7 +367,7 @@ This `@model` directive allows access to the movie that the controller passed to Examine the `Index.cshtml` view and the `Index` method in the Movies controller. Notice how the code creates a `List` object when it calls the `View` method. The code passes this `Movies` list from the `Index` action method to the view: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/MoviesController.cs?name=snippet_FirstIndexNoSearch)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/MoviesController.cs?name=snippet_FirstIndexNoSearch)] The code returns [problem details](xref:fundamentals/error-handling-api#problem-details-service) if the `Movie` property of the data context is null. diff --git a/aspnetcore/tutorials/first-mvc-app/adding-model/includes/adding-model9.md b/aspnetcore/tutorials/first-mvc-app/adding-model/includes/adding-model9.md index 285aa115ae2c..05f0646c65e2 100644 --- a/aspnetcore/tutorials/first-mvc-app/adding-model/includes/adding-model9.md +++ b/aspnetcore/tutorials/first-mvc-app/adding-model/includes/adding-model9.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-9.0" In this tutorial, classes are added for managing movies in a database. These classes are the "**M**odel" part of the **M**VC app. @@ -22,7 +27,7 @@ Add a file named `Movie.cs` to the *Models* folder. Update the `Models/Movie.cs` file with the following code: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Models/Movie.cs?name=snippet_First)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Models/Movie.cs?name=snippet_First)] The `Movie` class contains an `Id` field, which is required by the database for the primary key. @@ -375,7 +380,7 @@ This `@model` directive allows access to the movie that the controller passed to Examine the `Index.cshtml` view and the `Index` method in the Movies controller. Notice how the code creates a `List` object when it calls the `View` method. The code passes this `Movies` list from the `Index` action method to the view: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/MoviesController.cs?name=snippet_FirstIndexNoSearch)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/MoviesController.cs?name=snippet_FirstIndexNoSearch)] The code returns [problem details](xref:fundamentals/error-handling-api#problem-details-service) if the `Movie` property of the data context is null. diff --git a/aspnetcore/tutorials/first-mvc-app/adding-view.md b/aspnetcore/tutorials/first-mvc-app/adding-view.md index ab7d6315e824..072a94805ec2 100644 --- a/aspnetcore/tutorials/first-mvc-app/adding-view.md +++ b/aspnetcore/tutorials/first-mvc-app/adding-view.md @@ -2,8 +2,8 @@ title: Part 3, add a view to an ASP.NET Core MVC app ai-usage: ai-assisted description: Part 3 of tutorial series on ASP.NET Core MVC. -ms.date: 01/22/2026 monikerRange: '>= aspnetcore-3.1' +ms.date: 01/22/2026 uid: tutorials/first-mvc-app/adding-view --- @@ -91,7 +91,7 @@ Find the `@RenderBody()` line. `RenderBody` is a placeholder where all the view- Replace the content of the `Views/Shared/_Layout.cshtml` file with the following markup. The changes are highlighted: -[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Views/Shared/_Layout.cshtml?highlight=6,15,41)] +[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Views/Shared/_Layout.cshtml?highlight=6,15,41)] The preceding markup made the following changes: @@ -173,7 +173,7 @@ In `HelloWorldController.cs`, change the `Welcome` method to add a `Message` and The `ViewData` dictionary is a dynamic object, which means any type can be used. The `ViewData` object has no defined properties until something is added. The [MVC model binding system](xref:mvc/models/model-binding) automatically maps the named parameters `name` and `numTimes` from the query string to parameters in the method. The complete `HelloWorldController`: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/HelloWorldController.cs?name=snippet_ViewData&highlight=12-17)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/HelloWorldController.cs?name=snippet_ViewData&highlight=12-17)] The `ViewData` dictionary object contains data that will be passed to the view. diff --git a/aspnetcore/tutorials/first-mvc-app/adding-view/includes/adding-view8.md b/aspnetcore/tutorials/first-mvc-app/adding-view/includes/adding-view8.md index 9be99643a63e..0636d026305b 100644 --- a/aspnetcore/tutorials/first-mvc-app/adding-view/includes/adding-view8.md +++ b/aspnetcore/tutorials/first-mvc-app/adding-view/includes/adding-view8.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-8.0" In this section, you modify the `HelloWorldController` class to use [Razor](xref:mvc/views/razor) view files. This cleanly encapsulates the process of generating HTML responses to a client. @@ -78,7 +83,7 @@ Find the `@RenderBody()` line. `RenderBody` is a placeholder where all the view- Replace the content of the `Views/Shared/_Layout.cshtml` file with the following markup. The changes are highlighted: -[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Views/Shared/_Layout.cshtml?highlight=6,14,40)] +[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Views/Shared/_Layout.cshtml?highlight=6,14,40)] The preceding markup made the following changes: @@ -162,7 +167,7 @@ In `HelloWorldController.cs`, change the `Welcome` method to add a `Message` and The `ViewData` dictionary is a dynamic object, which means any type can be used. The `ViewData` object has no defined properties until something is added. The [MVC model binding system](xref:mvc/models/model-binding) automatically maps the named parameters `name` and `numTimes` from the query string to parameters in the method. The complete `HelloWorldController`: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/HelloWorldController.cs?name=snippet_ViewData&highlight=12-17)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/HelloWorldController.cs?name=snippet_ViewData&highlight=12-17)] The `ViewData` dictionary object contains data that will be passed to the view. diff --git a/aspnetcore/tutorials/first-mvc-app/adding-view/includes/adding-view9.md b/aspnetcore/tutorials/first-mvc-app/adding-view/includes/adding-view9.md index 5e6e9f3e3ef5..0ace384e36a3 100644 --- a/aspnetcore/tutorials/first-mvc-app/adding-view/includes/adding-view9.md +++ b/aspnetcore/tutorials/first-mvc-app/adding-view/includes/adding-view9.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-9.0" In this section, you modify the `HelloWorldController` class to use [Razor](xref:mvc/views/razor) view files. This cleanly encapsulates the process of generating HTML responses to a client. @@ -78,7 +83,7 @@ Find the `@RenderBody()` line. `RenderBody` is a placeholder where all the view- Replace the content of the `Views/Shared/_Layout.cshtml` file with the following markup. The changes are highlighted: -[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Views/Shared/_Layout.cshtml?highlight=6,15,41)] +[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Views/Shared/_Layout.cshtml?highlight=6,15,41)] The preceding markup made the following changes: @@ -160,7 +165,7 @@ In `HelloWorldController.cs`, change the `Welcome` method to add a `Message` and The `ViewData` dictionary is a dynamic object, which means any type can be used. The `ViewData` object has no defined properties until something is added. The [MVC model binding system](xref:mvc/models/model-binding) automatically maps the named parameters `name` and `numTimes` from the query string to parameters in the method. The complete `HelloWorldController`: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/HelloWorldController.cs?name=snippet_ViewData&highlight=12-17)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/HelloWorldController.cs?name=snippet_ViewData&highlight=12-17)] The `ViewData` dictionary object contains data that will be passed to the view. diff --git a/aspnetcore/tutorials/first-mvc-app/controller-methods-views.md b/aspnetcore/tutorials/first-mvc-app/controller-methods-views.md index c625ddd671f9..5becf705d2c6 100644 --- a/aspnetcore/tutorials/first-mvc-app/controller-methods-views.md +++ b/aspnetcore/tutorials/first-mvc-app/controller-methods-views.md @@ -19,7 +19,7 @@ We have a good start to the movie app, but the presentation isn't ideal, for exa Open the `Models/Movie.cs` file and add the highlighted lines shown below: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Models/Movie.cs?name=snippet_Second&highlight=2,3,12,13,16)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Models/Movie.cs?name=snippet_Second&highlight=2,3,12,13,16)] `DataAnnotations` are explained in the next tutorial. The [Display](xref:System.ComponentModel.DataAnnotations.DisplayAttribute) attribute specifies what to display for the name of a field (in this case "Release Date" instead of "ReleaseDate"). The [DataType](xref:System.ComponentModel.DataAnnotations.DataTypeAttribute) attribute specifies the type of the data (Date). diff --git a/aspnetcore/tutorials/first-mvc-app/controller-methods-views/includes/controller-methods-views8.md b/aspnetcore/tutorials/first-mvc-app/controller-methods-views/includes/controller-methods-views8.md index fdbc3dd1c688..77325f2286ea 100644 --- a/aspnetcore/tutorials/first-mvc-app/controller-methods-views/includes/controller-methods-views8.md +++ b/aspnetcore/tutorials/first-mvc-app/controller-methods-views/includes/controller-methods-views8.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-8.0" We have a good start to the movie app, but the presentation isn't ideal, for example, **ReleaseDate** should be two words. @@ -6,7 +11,7 @@ We have a good start to the movie app, but the presentation isn't ideal, for exa Open the `Models/Movie.cs` file and add the highlighted lines shown below: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Models/Movie.cs?name=snippet_Second&highlight=2,3,12-13,16)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Models/Movie.cs?name=snippet_Second&highlight=2,3,12-13,16)] `DataAnnotations` are explained in the next tutorial. The [Display](xref:System.ComponentModel.DataAnnotations.DisplayAttribute) attribute specifies what to display for the name of a field (in this case "Release Date" instead of "ReleaseDate"). The [DataType](xref:System.ComponentModel.DataAnnotations.DataTypeAttribute) attribute specifies the type of the data (Date), so the time information stored in the field isn't displayed. diff --git a/aspnetcore/tutorials/first-mvc-app/controller-methods-views/includes/controller-methods-views9.md b/aspnetcore/tutorials/first-mvc-app/controller-methods-views/includes/controller-methods-views9.md index 8e0fe8656f1c..7fc71dae4973 100644 --- a/aspnetcore/tutorials/first-mvc-app/controller-methods-views/includes/controller-methods-views9.md +++ b/aspnetcore/tutorials/first-mvc-app/controller-methods-views/includes/controller-methods-views9.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-9.0" We have a good start to the movie app, but the presentation isn't ideal, for example, **ReleaseDate** should be two words. @@ -6,7 +11,7 @@ We have a good start to the movie app, but the presentation isn't ideal, for exa Open the `Models/Movie.cs` file and add the highlighted lines shown below: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Models/Movie.cs?name=snippet_Second&highlight=2,3,12,13,16)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Models/Movie.cs?name=snippet_Second&highlight=2,3,12,13,16)] `DataAnnotations` are explained in the next tutorial. The [Display](xref:System.ComponentModel.DataAnnotations.DisplayAttribute) attribute specifies what to display for the name of a field (in this case "Release Date" instead of "ReleaseDate"). The [DataType](xref:System.ComponentModel.DataAnnotations.DataTypeAttribute) attribute specifies the type of the data (Date), so the time information stored in the field isn't displayed. diff --git a/aspnetcore/tutorials/first-mvc-app/details.md b/aspnetcore/tutorials/first-mvc-app/details.md index d2081056d24b..2d4ff7ca4dcb 100644 --- a/aspnetcore/tutorials/first-mvc-app/details.md +++ b/aspnetcore/tutorials/first-mvc-app/details.md @@ -25,15 +25,15 @@ EF makes it easy to search for data using the `FirstOrDefaultAsync` method. An i Examine the `Delete` and `DeleteConfirmed` methods. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/MoviesController.cs?name=snippet_Delete)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/MoviesController.cs?name=snippet_Delete)] Note that the `HTTP GET Delete` method doesn't delete the specified movie, it returns a view of the movie where you can submit (HttpPost) the deletion. Performing a delete operation in response to a GET request (or for that matter, performing an edit operation, create operation, or any other operation that changes data) opens up a security hole. The `[HttpPost]` method that deletes the data is named `DeleteConfirmed` to give the HTTP POST method a unique signature or name. The two method signatures are shown below: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/MoviesController.cs?name=snippet_DeleteSignature)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/MoviesController.cs?name=snippet_DeleteSignature)] -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/MoviesController.cs?name=snippet_DeleteConfirmedSignature)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/MoviesController.cs?name=snippet_DeleteConfirmedSignature)] The common language runtime (CLR) requires overloaded methods to have a unique parameter signature (same method name but different list of parameters). However, here you need two `Delete` methods -- one for GET and one for POST -- that both have the same parameter signature. (They both need to accept a single integer as a parameter.) diff --git a/aspnetcore/tutorials/first-mvc-app/details/includes/details8.md b/aspnetcore/tutorials/first-mvc-app/details/includes/details8.md index 2e810f5ff0fe..f697751adb73 100644 --- a/aspnetcore/tutorials/first-mvc-app/details/includes/details8.md +++ b/aspnetcore/tutorials/first-mvc-app/details/includes/details8.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-8.0" Open the Movie controller and examine the `Details` method: @@ -12,15 +17,15 @@ EF makes it easy to search for data using the `FirstOrDefaultAsync` method. An i Examine the `Delete` and `DeleteConfirmed` methods. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/MoviesController.cs?name=snippet_Delete)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/MoviesController.cs?name=snippet_Delete)] Note that the `HTTP GET Delete` method doesn't delete the specified movie, it returns a view of the movie where you can submit (HttpPost) the deletion. Performing a delete operation in response to a GET request (or for that matter, performing an edit operation, create operation, or any other operation that changes data) opens up a security hole. The `[HttpPost]` method that deletes the data is named `DeleteConfirmed` to give the HTTP POST method a unique signature or name. The two method signatures are shown below: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/MoviesController.cs?name=snippet_DeleteSignature)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/MoviesController.cs?name=snippet_DeleteSignature)] -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/MoviesController.cs?name=snippet_DeleteConfirmedSignature)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/MoviesController.cs?name=snippet_DeleteConfirmedSignature)] The common language runtime (CLR) requires overloaded methods to have a unique parameter signature (same method name but different list of parameters). However, here you need two `Delete` methods -- one for GET and one for POST -- that both have the same parameter signature. (They both need to accept a single integer as a parameter.) diff --git a/aspnetcore/tutorials/first-mvc-app/details/includes/details9.md b/aspnetcore/tutorials/first-mvc-app/details/includes/details9.md index fde22b7e094b..508dbd874bec 100644 --- a/aspnetcore/tutorials/first-mvc-app/details/includes/details9.md +++ b/aspnetcore/tutorials/first-mvc-app/details/includes/details9.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-9.0" Open the Movie controller and examine the `Details` method: @@ -12,15 +17,15 @@ EF makes it easy to search for data using the `FirstOrDefaultAsync` method. An i Examine the `Delete` and `DeleteConfirmed` methods. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/MoviesController.cs?name=snippet_Delete)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/MoviesController.cs?name=snippet_Delete)] Note that the `HTTP GET Delete` method doesn't delete the specified movie, it returns a view of the movie where you can submit (HttpPost) the deletion. Performing a delete operation in response to a GET request (or for that matter, performing an edit operation, create operation, or any other operation that changes data) opens up a security hole. The `[HttpPost]` method that deletes the data is named `DeleteConfirmed` to give the HTTP POST method a unique signature or name. The two method signatures are shown below: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/MoviesController.cs?name=snippet_DeleteSignature)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/MoviesController.cs?name=snippet_DeleteSignature)] -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/MoviesController.cs?name=snippet_DeleteConfirmedSignature)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/MoviesController.cs?name=snippet_DeleteConfirmedSignature)] The common language runtime (CLR) requires overloaded methods to have a unique parameter signature (same method name but different list of parameters). However, here you need two `Delete` methods -- one for GET and one for POST -- that both have the same parameter signature. (They both need to accept a single integer as a parameter.) diff --git a/aspnetcore/tutorials/first-mvc-app/new-field.md b/aspnetcore/tutorials/first-mvc-app/new-field.md index 31eaadd02420..728b4bcec9f9 100644 --- a/aspnetcore/tutorials/first-mvc-app/new-field.md +++ b/aspnetcore/tutorials/first-mvc-app/new-field.md @@ -26,7 +26,7 @@ When Entity Framework (EF) is used to automatically create a database from model Add a `Rating` property to `Models/Movie.cs`: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Models/Movie.cs?name=snippet_AddRating&highlight=19)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Models/Movie.cs?name=snippet_AddRating&highlight=19)] Build the app diff --git a/aspnetcore/tutorials/first-mvc-app/new-field/includes/new-field8.md b/aspnetcore/tutorials/first-mvc-app/new-field/includes/new-field8.md index 53ac53e5f9f0..76402fd5897c 100644 --- a/aspnetcore/tutorials/first-mvc-app/new-field/includes/new-field8.md +++ b/aspnetcore/tutorials/first-mvc-app/new-field/includes/new-field8.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-8.0" In this section [Entity Framework Core migrations](/ef/core/managing-schemas/migrations/) is used to: @@ -14,7 +19,7 @@ When EF Code First is used to automatically create a database, Code First: Add a `Rating` property to `Models/Movie.cs`: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Models/Movie.cs?name=snippet_AddRating&highlight=19)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Models/Movie.cs?name=snippet_AddRating&highlight=19)] Build the app diff --git a/aspnetcore/tutorials/first-mvc-app/new-field/includes/new-field9.md b/aspnetcore/tutorials/first-mvc-app/new-field/includes/new-field9.md index cfb0209921d2..308acd5eccfc 100644 --- a/aspnetcore/tutorials/first-mvc-app/new-field/includes/new-field9.md +++ b/aspnetcore/tutorials/first-mvc-app/new-field/includes/new-field9.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-9.0" In this section [Entity Framework](/ef/core/get-started/aspnetcore/new-db) Migrations is used to: @@ -14,7 +19,7 @@ When Entity Framework (EF) is used to automatically create a database from model Add a `Rating` property to `Models/Movie.cs`: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Models/Movie.cs?name=snippet_AddRating&highlight=19)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Models/Movie.cs?name=snippet_AddRating&highlight=19)] Build the app @@ -85,7 +90,7 @@ For this tutorial, Entity Framework Migrations is used. From the **Tools** menu, select **NuGet Package Manager > Package Manager Console**. - ![PMC menu](~/tutorials/first-mvc-app/new-field/_static/9/pmc-VS22-17.11.0.png) + ![PMC menu](~/tutorials/first-mvc-app/new-field/_static/9/pmc-vs22-17.11.0.png) In the Package Manager Console, enter the following command: diff --git a/aspnetcore/tutorials/first-mvc-app/search.md b/aspnetcore/tutorials/first-mvc-app/search.md index 36d0b2cba386..9072ef875ce4 100644 --- a/aspnetcore/tutorials/first-mvc-app/search.md +++ b/aspnetcore/tutorials/first-mvc-app/search.md @@ -17,7 +17,7 @@ In this section, you add search capability to the `Index` action method that let Update the `Index` method found inside `Controllers/MoviesController.cs` with the following code: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/MoviesController.cs?name=snippet_IndexSearch1)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/MoviesController.cs?name=snippet_IndexSearch1)] The following line in the `Index` action method creates a [LINQ](/dotnet/standard/using-linq) query to select the movies: @@ -30,7 +30,7 @@ The query is *only defined* at this point, it has **not** been run against the d If the `searchString` parameter contains a string, the movies query is modified to filter on the value of the search string: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/MoviesController.cs?name=snippet_IndexSearchCheckForNull)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/MoviesController.cs?name=snippet_IndexSearchCheckForNull)] The `s => s.Title!.ToUpper().Contains(searchString.ToUpper())` code above is a [Lambda Expression](/dotnet/csharp/programming-guide/statements-expressions-operators/lambda-expressions). Lambdas are used in method-based [LINQ](/dotnet/standard/using-linq) queries as arguments to standard query operator methods such as the method or `Contains` (used in the code above). LINQ queries are not executed when they're defined or when they're modified by calling a method such as `Where`, `Contains`, or `OrderBy`. Rather, query execution is deferred. That means that the evaluation of an expression is delayed until its realized value is actually iterated over or the `ToListAsync` method is called. For more information about deferred query execution, see [Query Execution](/dotnet/framework/data/adonet/ef/language-reference/query-execution). @@ -53,11 +53,11 @@ Change the parameter to `id` and change all occurrences of `searchString` to `id The previous `Index` method: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/MoviesController.cs?name=snippet_IndexSearch1)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/MoviesController.cs?name=snippet_IndexSearch1)] The updated `Index` method with `id` parameter: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/MoviesController.cs?highlight=1,11,13&name=snippet_IndexSearchID)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/MoviesController.cs?highlight=1,11,13&name=snippet_IndexSearchID)] You can now pass the search title as route data (a URL segment) instead of as a query string value. @@ -65,7 +65,7 @@ You can now pass the search title as route data (a URL segment) instead of as a However, you can't expect users to modify the URL every time they want to search for a movie. So now you'll add UI elements to help them filter movies. If you changed the signature of the `Index` method to test how to pass the route-bound `ID` parameter, change it back so that it takes a parameter named `searchString`: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/MoviesController.cs?highlight=1,11,13&name=snippet_IndexSearch1)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/MoviesController.cs?highlight=1,11,13&name=snippet_IndexSearch1)] Open the `Views/Movies/Index.cshtml` file, and add the `
` markup highlighted in the following code snippet: @@ -79,7 +79,7 @@ There's no `[HttpPost]` overload of the `Index` method as you might expect. You You could add the following `[HttpPost] Index` method. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/MoviesController.cs?highlight=1&name=snippet_IndexPost)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/MoviesController.cs?highlight=1&name=snippet_IndexPost)] The `notUsed` parameter is used to create an overload for the `Index` method. We'll talk about that later in the tutorial. @@ -111,7 +111,7 @@ Now when you submit a search, the URL contains the search query string. Searchin Add the following `MovieGenreViewModel` class to the *Models* folder: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Models/MovieGenreViewModel.cs)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Models/MovieGenreViewModel.cs)] The movie-genre view model will contain: @@ -122,11 +122,11 @@ The movie-genre view model will contain: Replace the `Index` method in `MoviesController.cs` with the following code: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/MoviesController.cs?name=snippet_IndexGenre)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/MoviesController.cs?name=snippet_IndexGenre)] The following code is a `LINQ` query that retrieves all the genres from the database. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Controllers/MoviesController.cs?name=snippet_IndexGenreLINQ)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Controllers/MoviesController.cs?name=snippet_IndexGenreLINQ)] The `SelectList` of genres is created by projecting the distinct genres (we don't want our select list to have duplicate genres). @@ -136,7 +136,7 @@ When the user searches for the item, the search value is retained in the search Update `Index.cshtml` found in *Views/Movies/* as follows: -[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Views/Movies/IndexFormGenreNoRating.cshtml?highlight=1,15,16,17,19,28,31,34,37,43)] +[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Views/Movies/IndexFormGenreNoRating.cshtml?highlight=1,15,16,17,19,28,31,34,37,43)] Examine the lambda expression used in the following HTML Helper: diff --git a/aspnetcore/tutorials/first-mvc-app/search/includes/search8.md b/aspnetcore/tutorials/first-mvc-app/search/includes/search8.md index d5d77cef6594..4e648031340c 100644 --- a/aspnetcore/tutorials/first-mvc-app/search/includes/search8.md +++ b/aspnetcore/tutorials/first-mvc-app/search/includes/search8.md @@ -1,10 +1,15 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-8.0" In this section, you add search capability to the `Index` action method that lets you search movies by *genre* or *name*. Update the `Index` method found inside `Controllers/MoviesController.cs` with the following code: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/MoviesController.cs?name=snippet_IndexSearch1)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/MoviesController.cs?name=snippet_IndexSearch1)] The following line in the `Index` action method creates a [LINQ](/dotnet/standard/using-linq) query to select the movies: @@ -17,7 +22,7 @@ The query is *only defined* at this point, it has **not** been run against the d If the `searchString` parameter contains a string, the movies query is modified to filter on the value of the search string: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/MoviesController.cs?name=snippet_IndexSearchCheckForNull)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/MoviesController.cs?name=snippet_IndexSearchCheckForNull)] The `s => s.Title!.ToUpper().Contains(searchString.ToUpper())` code above is a [Lambda Expression](/dotnet/csharp/programming-guide/statements-expressions-operators/lambda-expressions). Lambdas are used in method-based [LINQ](/dotnet/standard/using-linq) queries as arguments to standard query operator methods such as the method or `Contains` (used in the code above). LINQ queries are not executed when they're defined or when they're modified by calling a method such as `Where`, `Contains`, or `OrderBy`. Rather, query execution is deferred. That means that the evaluation of an expression is delayed until its realized value is actually iterated over or the `ToListAsync` method is called. For more information about deferred query execution, see [Query Execution](/dotnet/framework/data/adonet/ef/language-reference/query-execution). @@ -40,11 +45,11 @@ Change the parameter to `id` and change all occurrences of `searchString` to `id The previous `Index` method: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/MoviesController.cs?name=snippet_IndexSearch1)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/MoviesController.cs?name=snippet_IndexSearch1)] The updated `Index` method with `id` parameter: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/MoviesController.cs?highlight=1,11,13&name=snippet_IndexSearchID)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/MoviesController.cs?highlight=1,11,13&name=snippet_IndexSearchID)] You can now pass the search title as route data (a URL segment) instead of as a query string value. @@ -52,7 +57,7 @@ You can now pass the search title as route data (a URL segment) instead of as a However, you can't expect users to modify the URL every time they want to search for a movie. So now you'll add UI elements to help them filter movies. If you changed the signature of the `Index` method to test how to pass the route-bound `ID` parameter, change it back so that it takes a parameter named `searchString`: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/MoviesController.cs?highlight=1,11,13&name=snippet_IndexSearch1)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/MoviesController.cs?highlight=1,11,13&name=snippet_IndexSearch1)] Open the `Views/Movies/Index.cshtml` file, and add the `` markup highlighted below: @@ -66,7 +71,7 @@ There's no `[HttpPost]` overload of the `Index` method as you might expect. You You could add the following `[HttpPost] Index` method. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/MoviesController.cs?highlight=1&name=snippet_IndexPost)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/MoviesController.cs?highlight=1&name=snippet_IndexPost)] The `notUsed` parameter is used to create an overload for the `Index` method. We'll talk about that later in the tutorial. @@ -98,7 +103,7 @@ The following markup shows the change to the `form` tag: Add the following `MovieGenreViewModel` class to the *Models* folder: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Models/MovieGenreViewModel.cs)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Models/MovieGenreViewModel.cs)] The movie-genre view model will contain: @@ -109,11 +114,11 @@ The movie-genre view model will contain: Replace the `Index` method in `MoviesController.cs` with the following code: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/MoviesController.cs?name=snippet_IndexGenre)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/MoviesController.cs?name=snippet_IndexGenre)] The following code is a `LINQ` query that retrieves all the genres from the database. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Controllers/MoviesController.cs?name=snippet_IndexGenreLINQ)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Controllers/MoviesController.cs?name=snippet_IndexGenreLINQ)] The `SelectList` of genres is created by projecting the distinct genres (we don't want our select list to have duplicate genres). @@ -123,7 +128,7 @@ When the user searches for the item, the search value is retained in the search Update `Index.cshtml` found in *Views/Movies/* as follows: -[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Views/Movies/IndexFormGenreNoRating.cshtml?highlight=1,15,16,17,19,28,31,34,37,43)] +[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Views/Movies/IndexFormGenreNoRating.cshtml?highlight=1,15,16,17,19,28,31,34,37,43)] Examine the lambda expression used in the following HTML Helper: diff --git a/aspnetcore/tutorials/first-mvc-app/search/includes/search9.md b/aspnetcore/tutorials/first-mvc-app/search/includes/search9.md index 3c00ede13abe..6b51d2258826 100644 --- a/aspnetcore/tutorials/first-mvc-app/search/includes/search9.md +++ b/aspnetcore/tutorials/first-mvc-app/search/includes/search9.md @@ -1,10 +1,15 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-9.0" In this section, you add search capability to the `Index` action method that lets you search movies by *genre* or *name*. Update the `Index` method found inside `Controllers/MoviesController.cs` with the following code: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/MoviesController.cs?name=snippet_IndexSearch1)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/MoviesController.cs?name=snippet_IndexSearch1)] The following line in the `Index` action method creates a [LINQ](/dotnet/standard/using-linq) query to select the movies: @@ -17,7 +22,7 @@ The query is *only defined* at this point, it has **not** been run against the d If the `searchString` parameter contains a string, the movies query is modified to filter on the value of the search string: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/MoviesController.cs?name=snippet_IndexSearchCheckForNull)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/MoviesController.cs?name=snippet_IndexSearchCheckForNull)] The `s => s.Title!.ToUpper().Contains(searchString.ToUpper())` code above is a [Lambda Expression](/dotnet/csharp/programming-guide/statements-expressions-operators/lambda-expressions). Lambdas are used in method-based [LINQ](/dotnet/standard/using-linq) queries as arguments to standard query operator methods such as the method or `Contains` (used in the code above). LINQ queries are not executed when they're defined or when they're modified by calling a method such as `Where`, `Contains`, or `OrderBy`. Rather, query execution is deferred. That means that the evaluation of an expression is delayed until its realized value is actually iterated over or the `ToListAsync` method is called. For more information about deferred query execution, see [Query Execution](/dotnet/framework/data/adonet/ef/language-reference/query-execution). @@ -40,11 +45,11 @@ Change the parameter to `id` and change all occurrences of `searchString` to `id The previous `Index` method: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/MoviesController.cs?name=snippet_IndexSearch1)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/MoviesController.cs?name=snippet_IndexSearch1)] The updated `Index` method with `id` parameter: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/MoviesController.cs?highlight=1,11,13&name=snippet_IndexSearchID)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/MoviesController.cs?highlight=1,11,13&name=snippet_IndexSearchID)] You can now pass the search title as route data (a URL segment) instead of as a query string value. @@ -52,7 +57,7 @@ You can now pass the search title as route data (a URL segment) instead of as a However, you can't expect users to modify the URL every time they want to search for a movie. So now you'll add UI elements to help them filter movies. If you changed the signature of the `Index` method to test how to pass the route-bound `ID` parameter, change it back so that it takes a parameter named `searchString`: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/MoviesController.cs?highlight=1,11,13&name=snippet_IndexSearch1)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/MoviesController.cs?highlight=1,11,13&name=snippet_IndexSearch1)] Open the `Views/Movies/Index.cshtml` file, and add the `` markup highlighted below: @@ -66,7 +71,7 @@ There's no `[HttpPost]` overload of the `Index` method as you might expect. You You could add the following `[HttpPost] Index` method. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/MoviesController.cs?highlight=1&name=snippet_IndexPost)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/MoviesController.cs?highlight=1&name=snippet_IndexPost)] The `notUsed` parameter is used to create an overload for the `Index` method. We'll talk about that later in the tutorial. @@ -98,7 +103,7 @@ Now when you submit a search, the URL contains the search query string. Searchin Add the following `MovieGenreViewModel` class to the *Models* folder: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Models/MovieGenreViewModel.cs)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Models/MovieGenreViewModel.cs)] The movie-genre view model will contain: @@ -109,11 +114,11 @@ The movie-genre view model will contain: Replace the `Index` method in `MoviesController.cs` with the following code: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/MoviesController.cs?name=snippet_IndexGenre)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/MoviesController.cs?name=snippet_IndexGenre)] The following code is a `LINQ` query that retrieves all the genres from the database. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Controllers/MoviesController.cs?name=snippet_IndexGenreLINQ)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Controllers/MoviesController.cs?name=snippet_IndexGenreLINQ)] The `SelectList` of genres is created by projecting the distinct genres (we don't want our select list to have duplicate genres). @@ -123,7 +128,7 @@ When the user searches for the item, the search value is retained in the search Update `Index.cshtml` found in *Views/Movies/* as follows: -[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Views/Movies/IndexFormGenreNoRating.cshtml?highlight=1,15,16,17,19,28,31,34,37,43)] +[!code-cshtml[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Views/Movies/IndexFormGenreNoRating.cshtml?highlight=1,15,16,17,19,28,31,34,37,43)] Examine the lambda expression used in the following HTML Helper: diff --git a/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc5.md b/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc5.md index 7440b277fe8d..d5386b6e631b 100644 --- a/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc5.md +++ b/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc5.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-5.0" [!INCLUDE [consider RP](~/includes/razor.md)] @@ -124,7 +129,7 @@ You can debug the app by selecting the **IIS Express** button The following image shows the app: -![Home or Index page](~/tutorials/first-mvc-app/start-mvc/_static/home50-vs.png) +![Home or Index page](~/tutorials/first-mvc-app/start-mvc/_static/home50-VS.png) # [Visual Studio Code](#tab/visual-studio-code) diff --git a/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc6.md b/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc6.md index cf43075e0c55..6e22bc603088 100644 --- a/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc6.md +++ b/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc6.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-6.0" [!INCLUDE [consider RP](~/includes/razor.md)] @@ -127,7 +132,7 @@ You can debug the app by selecting the **MvcMovie** button in the toolbar: The following image shows the app: -![Home or Index page](~/tutorials/first-mvc-app/start-mvc/_static/home50-vs.png) +![Home or Index page](~/tutorials/first-mvc-app/start-mvc/_static/home50-VS.png) # [Visual Studio Code](#tab/visual-studio-code) diff --git a/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc7.md b/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc7.md index 47c71691419c..34cc9e464ae3 100644 --- a/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc7.md +++ b/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc7.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-7.0" [!INCLUDE [consider RP](~/includes/razor.md)] @@ -119,7 +124,7 @@ You can debug the app by selecting the **https** button in the toolbar: The following image shows the app: -![Home or Index page](~/tutorials/first-mvc-app/start-mvc/_static/home50-vs.png) +![Home or Index page](~/tutorials/first-mvc-app/start-mvc/_static/home50-VS.png) * Close the browser window. Visual Studio will stop the application. diff --git a/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc8.md b/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc8.md index a20ff8c02928..f2469b5a833a 100644 --- a/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc8.md +++ b/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc8.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-8.0" [!INCLUDE [consider RP](~/includes/razor.md)] @@ -104,7 +109,7 @@ You can debug the app by selecting the **https** button in the toolbar: The following image shows the app: -![Home or Index page](~/tutorials/first-mvc-app/start-mvc/_static/home80-vs.png) +![Home or Index page](~/tutorials/first-mvc-app/start-mvc/_static/home80-VS.png) * Close the browser window. Visual Studio will stop the application. @@ -128,7 +133,7 @@ Launching the app without debugging by selecting Ctrl+F5 allows you to: * Save the file. * Quickly refresh the browser and see the code changes. - ![Home or Index page](~/tutorials/first-mvc-app/start-mvc/_static/home80-vs.png) + ![Home or Index page](~/tutorials/first-mvc-app/start-mvc/_static/home80-VS.png) * Close the browser window. diff --git a/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc9.md b/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc9.md index ab8edd632fa9..7a3d930821e0 100644 --- a/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc9.md +++ b/aspnetcore/tutorials/first-mvc-app/start-mvc/includes/start-mvc9.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-9.0" [!INCLUDE [consider RP](~/includes/razor.md)] @@ -46,7 +51,7 @@ See https://github.com/dotnet/AspNetCore.Docs/issues/21193 * Verify that **Do not use top-level statements** is unchecked. * Select **Create**. -![Additional info dialog](~/tutorials/first-mvc-app/start-mvc/_static/9/additional-info-VS22-17.11.0.png) +![Additional info dialog](~/tutorials/first-mvc-app/start-mvc/_static/9/additional-info-vs22-17.11.0.png) For more information, including alternative approaches to create the project, see [Create a new project in Visual Studio](/visualstudio/ide/create-new-project). diff --git a/aspnetcore/tutorials/first-mvc-app/validation.md b/aspnetcore/tutorials/first-mvc-app/validation.md index 00988f92caa1..d345ce4cd978 100644 --- a/aspnetcore/tutorials/first-mvc-app/validation.md +++ b/aspnetcore/tutorials/first-mvc-app/validation.md @@ -107,7 +107,7 @@ When you need to change validation logic, you can do so in exactly one place by Open the `Movie.cs` file and examine the `Movie` class. The `System.ComponentModel.DataAnnotations` namespace provides formatting attributes in addition to the built-in set of validation attributes. We've already applied a `DataType` enumeration value to the release date and to the price fields. The following code shows the `ReleaseDate` and `Price` properties with the appropriate `DataType` attribute. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Models/Movie.cs?highlight=2,6&name=snippet_DataType)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Models/Movie.cs?highlight=2,6&name=snippet_DataType)] The `DataType` attributes only provide hints for the view engine to format the data and supplies elements/attributes such as `` for URL's and `` for email. You can use the `RegularExpression` attribute to validate the format of the data. The `DataType` attribute is used to specify a data type that's more specific than the database intrinsic type, they're not validation attributes. In this case we only want to keep track of the date, not the time. The `DataType` Enumeration provides for many data types, such as Date, Time, PhoneNumber, Currency, EmailAddress and more. The `DataType` attribute can also enable the application to automatically provide type-specific features. For example, a `mailto:` link can be created for `DataType.EmailAddress`, and a date selector can be provided for `DataType.Date` in browsers that support HTML5. The `DataType` attributes emit HTML 5 `data-` (pronounced data dash) attributes that HTML 5 browsers can understand. The `DataType` attributes do **not** provide any validation. diff --git a/aspnetcore/tutorials/first-mvc-app/validation/includes/validation8.md b/aspnetcore/tutorials/first-mvc-app/validation/includes/validation8.md index aa9730adb029..16ca212299bd 100644 --- a/aspnetcore/tutorials/first-mvc-app/validation/includes/validation8.md +++ b/aspnetcore/tutorials/first-mvc-app/validation/includes/validation8.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-8.0" In this section: @@ -72,7 +77,7 @@ When you need to change validation logic, you can do so in exactly one place by Open the `Movie.cs` file and examine the `Movie` class. The `System.ComponentModel.DataAnnotations` namespace provides formatting attributes in addition to the built-in set of validation attributes. We've already applied a `DataType` enumeration value to the release date and to the price fields. The following code shows the `ReleaseDate` and `Price` properties with the appropriate `DataType` attribute. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Models/Movie.cs?highlight=2,6&name=snippet_DataType)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Models/Movie.cs?highlight=2,6&name=snippet_DataType)] The `DataType` attributes only provide hints for the view engine to format the data and supplies elements/attributes such as `` for URL's and `` for email. You can use the `RegularExpression` attribute to validate the format of the data. The `DataType` attribute is used to specify a data type that's more specific than the database intrinsic type, they're not validation attributes. In this case we only want to keep track of the date, not the time. The `DataType` Enumeration provides for many data types, such as Date, Time, PhoneNumber, Currency, EmailAddress and more. The `DataType` attribute can also enable the application to automatically provide type-specific features. For example, a `mailto:` link can be created for `DataType.EmailAddress`, and a date selector can be provided for `DataType.Date` in browsers that support HTML5. The `DataType` attributes emit HTML 5 `data-` (pronounced data dash) attributes that HTML 5 browsers can understand. The `DataType` attributes do **not** provide any validation. @@ -105,7 +110,7 @@ You will need to disable jQuery date validation to use the `Range` attribute wit The following code shows combining attributes on one line: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Models/Movie.cs?name=snippet_AttrOneLine)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Models/Movie.cs?name=snippet_AttrOneLine)] ## Apply migrations diff --git a/aspnetcore/tutorials/first-mvc-app/validation/includes/validation9.md b/aspnetcore/tutorials/first-mvc-app/validation/includes/validation9.md index f1a688466534..29d71803aeaa 100644 --- a/aspnetcore/tutorials/first-mvc-app/validation/includes/validation9.md +++ b/aspnetcore/tutorials/first-mvc-app/validation/includes/validation9.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-9.0" In this section: @@ -72,7 +77,7 @@ When you need to change validation logic, you can do so in exactly one place by Open the `Movie.cs` file and examine the `Movie` class. The `System.ComponentModel.DataAnnotations` namespace provides formatting attributes in addition to the built-in set of validation attributes. We've already applied a `DataType` enumeration value to the release date and to the price fields. The following code shows the `ReleaseDate` and `Price` properties with the appropriate `DataType` attribute. -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Models/Movie.cs?highlight=2,6&name=snippet_DataType)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Models/Movie.cs?highlight=2,6&name=snippet_DataType)] The `DataType` attributes only provide hints for the view engine to format the data and supplies elements/attributes such as `` for URL's and `` for email. You can use the `RegularExpression` attribute to validate the format of the data. The `DataType` attribute is used to specify a data type that's more specific than the database intrinsic type, they're not validation attributes. In this case we only want to keep track of the date, not the time. The `DataType` Enumeration provides for many data types, such as Date, Time, PhoneNumber, Currency, EmailAddress and more. The `DataType` attribute can also enable the application to automatically provide type-specific features. For example, a `mailto:` link can be created for `DataType.EmailAddress`, and a date selector can be provided for `DataType.Date` in browsers that support HTML5. The `DataType` attributes emit HTML 5 `data-` (pronounced data dash) attributes that HTML 5 browsers can understand. The `DataType` attributes do **not** provide any validation. @@ -105,7 +110,7 @@ You will need to disable jQuery date validation to use the `Range` attribute wit The following code shows combining attributes on one line: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Models/Movie.cs?name=snippet_AttrOneLine)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Models/Movie.cs?name=snippet_AttrOneLine)] ## Apply migrations diff --git a/aspnetcore/tutorials/first-mvc-app/working-with-sql.md b/aspnetcore/tutorials/first-mvc-app/working-with-sql.md index 2aa60a620c2a..4024803cd834 100644 --- a/aspnetcore/tutorials/first-mvc-app/working-with-sql.md +++ b/aspnetcore/tutorials/first-mvc-app/working-with-sql.md @@ -85,7 +85,7 @@ Right-click on the `Movie` table **> View Data** # [Visual Studio Code](#tab/visual-studio-code) -[!INCLUDE[](~/includes/rp/sqlite.md)] +[!INCLUDE[](~/includes/RP/sqlite.md)] [!INCLUDE[](~/includes/RP-mvc-shared/sqlite-warn.md)] --- @@ -95,7 +95,7 @@ Right-click on the `Movie` table **> View Data** Create a new class named `SeedData` in the *Models* folder. Replace the generated code with the following: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie10/Models/SeedData.cs?name=snippet_FirstVersion)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie10/Models/SeedData.cs?name=snippet_FirstVersion)] If there are any movies in the database, the seed initializer returns and no movies are added. diff --git a/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql3-5.md b/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql3-5.md index 87c1cd7399ae..fb9a8e5569ca 100644 --- a/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql3-5.md +++ b/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql3-5.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range=">= aspnetcore-3.1 < aspnetcore-6.0" ## Introduction @@ -72,7 +77,7 @@ Right-click on the `Movie` table **> View Data** # [Visual Studio Code / Visual Studio for Mac](#tab/visual-studio-code+visual-studio-mac) -[!INCLUDE[](~/includes/rp/sqlite.md)] +[!INCLUDE[](~/includes/RP/sqlite.md)] [!INCLUDE[](~/includes/RP-mvc-shared/sqlite-warn.md)] --- diff --git a/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql6.md b/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql6.md index 974cf33d8caa..014655c99739 100644 --- a/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql6.md +++ b/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql6.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-6.0" ## Introduction @@ -75,7 +80,7 @@ Right-click on the `Movie` table **> View Data** # [Visual Studio Code / Visual Studio for Mac](#tab/visual-studio-code+visual-studio-mac) -[!INCLUDE[](~/includes/rp/sqlite.md)] +[!INCLUDE[](~/includes/RP/sqlite.md)] [!INCLUDE[](~/includes/RP-mvc-shared/sqlite-warn.md)] --- diff --git a/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql7.md b/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql7.md index e3278fa4163a..a23646424fb9 100644 --- a/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql7.md +++ b/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql7.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-7.0" ## Introduction @@ -71,7 +76,7 @@ Right-click on the `Movie` table **> View Data** # [Visual Studio Code / Visual Studio for Mac](#tab/visual-studio-code+visual-studio-mac) -[!INCLUDE[](~/includes/rp/sqlite.md)] +[!INCLUDE[](~/includes/RP/sqlite.md)] [!INCLUDE[](~/includes/RP-mvc-shared/sqlite-warn.md)] --- diff --git a/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql8.md b/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql8.md index 953bd423d48e..ddcad824f460 100644 --- a/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql8.md +++ b/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql8.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-8.0" ## Introduction @@ -71,7 +76,7 @@ Right-click on the `Movie` table **> View Data** # [Visual Studio Code](#tab/visual-studio-code) -[!INCLUDE[](~/includes/rp/sqlite.md)] +[!INCLUDE[](~/includes/RP/sqlite.md)] [!INCLUDE[](~/includes/RP-mvc-shared/sqlite-warn.md)] --- @@ -81,7 +86,7 @@ Right-click on the `Movie` table **> View Data** Create a new class named `SeedData` in the *Models* folder. Replace the generated code with the following: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie80/Models/SeedData.cs?name=snippet_FirstVersion)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie80/Models/SeedData.cs?name=snippet_FirstVersion)] If there are any movies in the database, the seed initializer returns and no movies are added. diff --git a/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql9.md b/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql9.md index 98282aa47dd6..14e366f98c1b 100644 --- a/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql9.md +++ b/aspnetcore/tutorials/first-mvc-app/working-with-sql/includes/working-with-sql9.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-9.0" ## Introduction @@ -71,7 +76,7 @@ Right-click on the `Movie` table **> View Data** # [Visual Studio Code](#tab/visual-studio-code) -[!INCLUDE[](~/includes/rp/sqlite.md)] +[!INCLUDE[](~/includes/RP/sqlite.md)] [!INCLUDE[](~/includes/RP-mvc-shared/sqlite-warn.md)] --- @@ -81,7 +86,7 @@ Right-click on the `Movie` table **> View Data** Create a new class named `SeedData` in the *Models* folder. Replace the generated code with the following: -[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/mvcmovie90/Models/SeedData.cs?name=snippet_FirstVersion)] +[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/samples/MvcMovie90/Models/SeedData.cs?name=snippet_FirstVersion)] If there are any movies in the database, the seed initializer returns and no movies are added. diff --git a/aspnetcore/tutorials/razor-pages/model/includes/model5.md b/aspnetcore/tutorials/razor-pages/model/includes/model5.md index 9ff59d703459..0e466a0a34a9 100644 --- a/aspnetcore/tutorials/razor-pages/model/includes/model5.md +++ b/aspnetcore/tutorials/razor-pages/model/includes/model5.md @@ -1,3 +1,8 @@ +--- +ai-usage: ai-assisted +ms.date: 10/15/2026 +--- + :::moniker range="= aspnetcore-5.0" @@ -151,7 +156,7 @@ For more information, see [dotnet aspnet-codegenerator](xref:fundamentals/tools/ 1. In the **DbContext Class to use:** row, name the class `RazorPagesMovie.Data.RazorPagesMovieContext`. 1. Select **Finish**. - ![Add Razor Pages on Mac](~/tutorials/razor-pages/model/_static/5/arpMac.png) + ![Add Razor Pages on Mac](~/tutorials/razor-pages/model/_static/5/arpmac.png) The `appsettings.json` file is updated with the connection string used to connect to a local database.