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
@@ -18,14 +18,18 @@ By [Rick Anderson](https://twitter.com/RickAndMSFT)
18
18
19
19
We have a good start to the movie app, but the presentation isn't ideal, for example, **ReleaseDate** should be two words.
20
20
21
-

21
+

22
22
23
23
Open the `Models/Movie.cs` file and add the highlighted lines shown below:
`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.
28
28
29
+
Using the data annotations above, run the application and refresh the `/Movies` page. Because the view markup uses the `@Html.DisplayNameFor` and `@Html.DisplayFor` methods to render the property name and value, the updated `Index` view shows all the fields properly formatted. For example, **Release Date** is now two words and the time information is no longer shown.
30
+
31
+

32
+
29
33
The `[Column(TypeName = "decimal(18, 2)")]` data annotation is required so Entity Framework Core can correctly map `Price` to currency in the database. For more information, see [Data Types](/ef/core/modeling/relational/data-types).
30
34
31
35
Browse to the `Movies` controller and hold the mouse pointer over an **Edit** link to see the target URL.
0 commit comments