AspNetCore.Docs/aspnetcore/includes/mvc-intro/model1b.md

13 lines
694 B
Markdown
Raw Normal View History

Add the following properties to the `Movie` class:
[!code-csharp[](~/tutorials/first-mvc-app/start-mvc/sample/MvcMovie22/Models/Movie.cs?name=snippet1)]
The `Movie` class contains:
* The `Id` field which is required by the database for the primary key.
* `[DataType(DataType.Date)]`: The [DataType](/dotnet/api/microsoft.aspnetcore.mvc.dataannotations.internal.datatypeattributeadapter) attribute specifies the type of the data (`Date`). With this attribute:
* The user is not required to enter time information in the date field.
* Only the date is displayed, not time information.
[DataAnnotations](/dotnet/api/system.componentmodel.dataannotations) are covered in a later tutorial.