Controller methods and views in an ASP.NET Core MVC app
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 following image) and ReleaseDate should be two words.
![Index view: Release Date is one word (no space) and every movie release date shows a time of 12 AM](../../tutorials/first-mvc-app/working-with-sql/_static/m55.png)
Open the Models/Movie.cs file and add the highlighted lines shown below:
[!code-csharpMain]
1: //#define AddDate
2: #if AddDate
3: #region snippet_1
4: using System;
5: using System.ComponentModel.DataAnnotations;
6:
7: namespace MvcMovie.Models
8: {
9: public class Movie
10: {
11: public int ID { get; set; }
12: public string Title { get; set; }
13:
14: [Display(Name = "Release Date")]
15: [DataType(DataType.Date)]
16: public DateTime ReleaseDate { get; set; }
17: public string Genre { get; set; }
18: public decimal Price { get; set; }
19: }
20: }
21: #endregion
22: #endif
Build and run the app.
[!INCLUDEadding-model]
Comments (
)
![](http://forum.vb-net.com/GetTopicCount.png?id=a0ff8c70-1f9f-4408-a4d1-d38fe8dcaaa0)
<00>
<01>
<02>
<03>
<04>
<05>
<06>
<07>
<08>
<09>
<10>
<11>
<12>
<13>
<14>
<15>
<16>
<17>
<18>
<19>
<20>
<21>
<22>
<23>
Link to this page:
//www.vb-net.com/AspNet-DocAndSamples-2017/aspnetcore/tutorials/first-mvc-app-mac/controller-methods-views.htm
<SITEMAP> <MVC> <ASP> <NET> <DATA> <KIOSK> <FLEX> <SQL> <NOTES> <LINUX> <MONO> <FREEWARE> <DOCS> <ENG> <CHAT ME> <ABOUT ME> < THANKS ME> |