1.9 KiB
1.9 KiB
title | author | description | keywords | ms.author | manager | ms.date | ms.topic | ms.assetid | ms.technology | ms.prod | uid |
---|---|---|---|---|---|---|---|---|---|---|---|
Controller methods and views | rick-anderson | Working with controller methods, views and DataAnnotations | ASP.NET Core, | riande | wpickett | 03/07/2017 | get-started-article | c7313211-b271-4adf-bab8-8e72603cc0ce | aspnet | asp.net-core | tutorials/first-mvc-app/controller-methods-views |
Controller methods and views
We have a good start to the movie app, but the presentation is not ideal. We don't want to see the time (12:00:00 AM in the image below) and ReleaseDate should be two words.
Open the Models/Movie.cs file and add the highlighted lines shown below:
[!code-csharpMain]
Right click on a red squiggly line > Quick Actions and Refactorings.
Tap using System.ComponentModel.DataAnnotations;
Visual studio adds using System.ComponentModel.DataAnnotations;
.
Let's remove the using
statements that are not needed. They show up by default in a light grey font. Right click anywhere in the Movie.cs file > Remove and Sort Usings.
The updated code:
[!code-csharpMain]
[!INCLUDEadding-model]