mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2025-12-06 05:32:03 +01:00
Errata for page 631
This commit is contained in:
parent
a0de8afa9d
commit
b1e9462227
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
If you find any mistakes in the seventh edition, *C# 11 and .NET 7 - Modern Cross-Platform Development Fundamentals*, or 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.
|
||||
|
||||
[**Errata** (13 items)](errata.md): Typos, tool user interface changes, or mistakes in code that would cause a compilation error that prevents a successful build.
|
||||
[**Errata** (14 items)](errata.md): Typos, tool user interface changes, or mistakes in code that would cause a compilation error that prevents a successful build.
|
||||
|
||||
[**Improvements** (1 item)](improvements.md): Changes to text or code that would improve the content. These are optional.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
**Errata** (13 items)
|
||||
**Errata** (14 items)
|
||||
|
||||
If you find any mistakes, then please [raise an issue in this repository](https://github.com/markjprice/cs11dotnet7/issues) or email me at markjprice (at) gmail.com.
|
||||
|
||||
|
|
@ -17,6 +17,7 @@ If you find any mistakes, then please [raise an issue in this repository](https:
|
|||
- [Page 412 - Compressing streams](#page-412---compressing-streams)
|
||||
- [Page 477 - Inserting entities](#page-477---inserting-entities)
|
||||
- [Page 627 - Defining a typed view](#page-627---defining-a-typed-view)
|
||||
- [Page 631 - Passing parameters using a route value](#page-631---passing-parameters-using-a-route-value)
|
||||
- [Page 649 - Varying cached data by query string](#page-649---varying-cached-data-by-query-string)
|
||||
|
||||
# Page 4, 8 - Pros and cons of the .NET Interactive Notebooks extension, Downloading and installing Visual Studio Code
|
||||
|
|
@ -178,6 +179,23 @@ Should be `data-bs-slide-to`, as shown in the following markup:
|
|||
|
||||
It was already correct in the GitHub copy of the code.
|
||||
|
||||
# Page 631 - Passing parameters using a route value
|
||||
|
||||
In Step 3, the statements attempt to output the values of the category name and unit price for the product, as shown in the following markup:
|
||||
```xml
|
||||
<dt>Category</dt>
|
||||
<dd>@Model.CategoryId - @Model.Category.CategoryName</dd>
|
||||
<dt>Unit Price</dt>
|
||||
<dd>@Model.UnitPrice.Value.ToString("C")</dd>
|
||||
```
|
||||
But since the `Category` and `UnitPrice` properties could be null, we should use a null checks, as shown in the following markup:
|
||||
```xml
|
||||
<dt>Category</dt>
|
||||
<dd>@Model.CategoryId - @Model.Category?.CategoryName</dd>
|
||||
<dt>Unit Price</dt>
|
||||
<dd>@(Model.UnitPrice is null ? "zero" : Model.UnitPrice.Value.ToString("C"))</dd>
|
||||
```
|
||||
|
||||
# Page 649 - Varying cached data by query string
|
||||
|
||||
> Thanks to [Chadwick Geyser](https://github.com/chadwickgeyser) for raising this [issue on 5 December 2022](https://github.com/markjprice/cs11dotnet7/issues/7).
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@
|
|||
<dt>Product Name</dt>
|
||||
<dd>@Model.ProductName</dd>
|
||||
<dt>Category</dt>
|
||||
<dd>@Model.CategoryId - @Model.Category.CategoryName</dd>
|
||||
<dd>@Model.CategoryId - @Model.Category?.CategoryName</dd>
|
||||
<dt>Unit Price</dt>
|
||||
<dd>@Model.UnitPrice.Value.ToString("C")</dd>
|
||||
<dd>@(Model.UnitPrice is null ? "zero" : Model.UnitPrice.Value.ToString("C"))</dd>
|
||||
<dt>Units In Stock</dt>
|
||||
<dd>@Model.UnitsInStock</dd>
|
||||
</dl>
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@
|
|||
<dt>Product Name</dt>
|
||||
<dd>@Model.ProductName</dd>
|
||||
<dt>Category</dt>
|
||||
<dd>@Model.CategoryId - @Model.Category.CategoryName</dd>
|
||||
<dd>@Model.CategoryId - @Model.Category?.CategoryName</dd>
|
||||
<dt>Unit Price</dt>
|
||||
<dd>@Model.UnitPrice.Value.ToString("C")</dd>
|
||||
<dd>@(Model.UnitPrice is null ? "zero" : Model.UnitPrice.Value.ToString("C"))</dd>
|
||||
<dt>Units In Stock</dt>
|
||||
<dd>@Model.UnitsInStock</dd>
|
||||
</dl>
|
||||
|
|
|
|||
Loading…
Reference in a new issue