AspNetCore.Docs/aspnetcore/includes/RP/model1b.md

18 lines
907 B
Markdown
Raw Normal View History

---
no-loc: [Home, Privacy, Kestrel, appsettings.json, "ASP.NET Core Identity", cookie, Cookie, Blazor, "Blazor Server", "Blazor WebAssembly", "Identity", "Let's Encrypt", Razor, SignalR]
---
<!-- THIS INCLUDE USED BY MVC AND RP -->
Add the following properties to the `Movie` class:
[!code-csharp[](~/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie22/Models/Movie.cs?name=snippet1)]
The `Movie` class contains:
* The `ID` field is required by the database for the primary key.
2020-04-20 04:44:51 +08:00
* `[DataType(DataType.Date)]`: The [DataType](xref:System.ComponentModel.DataAnnotations.DataTypeAttribute) 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.