diff --git a/docs/errata/README.md b/docs/errata/README.md index d47a586..a233a3b 100644 --- a/docs/errata/README.md +++ b/docs/errata/README.md @@ -4,6 +4,6 @@ If you find any mistakes in the seventh edition, *C# 11 and .NET 7 - Modern Cros [**Errata** (31 items)](errata.md): Typos, tool user interface changes, or mistakes in code that would cause a compilation error that prevents a successful build. -[**Improvements** (10 items)](improvements.md): Changes to text or code that would improve the content. These are optional. +[**Improvements** (11 items)](improvements.md): Changes to text or code that would improve the content. These are optional. All errata and improvements will be included in the 8th edition planned for publishing in November 2023. To be included they must be submitted by mid-September 2023. diff --git a/docs/errata/improvements.md b/docs/errata/improvements.md index bf9ce22..bcaf78d 100644 --- a/docs/errata/improvements.md +++ b/docs/errata/improvements.md @@ -1,4 +1,4 @@ -**Improvements** (10 items) +**Improvements** (11 items) If you have suggestions for improvements, then please [raise an issue in this repository](https://github.com/markjprice/cs11dotnet7/issues) or email me at markjprice (at) gmail.com. @@ -11,6 +11,7 @@ If you have suggestions for improvements, then please [raise an issue in this re - [Page 453 - Scaffolding models using an existing database](#page-453---scaffolding-models-using-an-existing-database) - [Page 547 - Creating a class library for a Northwind database context](#page-547---creating-a-class-library-for-a-northwind-database-context) - [Page 551 - Creating a class library for entity models using SQL Server](#page-551---creating-a-class-library-for-entity-models-using-sql-server) +- [Page 654 - Making controller action methods asynchronous](#page-654---making-controller-action-methods-asynchronous) - [Page 655 - Exercise 14.2 – Practice implementing MVC by implementing a category detail page](#page-655---exercise-142--practice-implementing-mvc-by-implementing-a-category-detail-page) # Page 86 - Getting text input from the user @@ -291,6 +292,16 @@ public static IServiceCollection AddNorthwindContext( } ``` +# Page 654 - Making controller action methods asynchronous + +In an earlier task, you imported the `Microsoft.EntityFrameworkCore` namespace so that you could use the `Include` extension method. In Step 1, I tell you to use the `ToListAsync` method to implement the `Index` action method asynchronously. If you had not previously imported the `Microsoft.EntityFrameworkCore` namespace then you would have to import it now to use the `ToListAsync` method. + +In the next edition, I will add a comment to make this more obvious, as shown in the following code: + +```cs +using Microsoft.EntityFrameworkCore; // To use the Include and ToListAsync extension methods. +``` + # Page 655 - Exercise 14.2 – Practice implementing MVC by implementing a category detail page Earlier in the chapter, and in Exercise 14.2, the link generated for a category detail page looks like this: diff --git a/vs4win/PracticalApps/Northwind.Mvc/Controllers/HomeController.cs b/vs4win/PracticalApps/Northwind.Mvc/Controllers/HomeController.cs index 495a3d1..cac8de0 100644 --- a/vs4win/PracticalApps/Northwind.Mvc/Controllers/HomeController.cs +++ b/vs4win/PracticalApps/Northwind.Mvc/Controllers/HomeController.cs @@ -3,7 +3,7 @@ using Northwind.Mvc.Models; // ErrorViewModel using System.Diagnostics; // Activity using Microsoft.AspNetCore.Authorization; // [Authorize] using Packt.Shared; // NorthwindContext -using Microsoft.EntityFrameworkCore; // Include extension method +using Microsoft.EntityFrameworkCore; // Include and ToListAsync extension methods namespace Northwind.Mvc.Controllers { diff --git a/vscode/PracticalApps/Northwind.Mvc/Controllers/HomeController.cs b/vscode/PracticalApps/Northwind.Mvc/Controllers/HomeController.cs index 495a3d1..cac8de0 100644 --- a/vscode/PracticalApps/Northwind.Mvc/Controllers/HomeController.cs +++ b/vscode/PracticalApps/Northwind.Mvc/Controllers/HomeController.cs @@ -3,7 +3,7 @@ using Northwind.Mvc.Models; // ErrorViewModel using System.Diagnostics; // Activity using Microsoft.AspNetCore.Authorization; // [Authorize] using Packt.Shared; // NorthwindContext -using Microsoft.EntityFrameworkCore; // Include extension method +using Microsoft.EntityFrameworkCore; // Include and ToListAsync extension methods namespace Northwind.Mvc.Controllers {