Skip to content

Commit 56e95ba

Browse files
authored
add missing ? to model types and combine left out data annotations into one line (#34579)
1 parent bccb03a commit 56e95ba

File tree

1 file changed

+4
-5
lines changed
  • aspnetcore/tutorials/first-mvc-app/start-mvc/sample/MvcMovie90/Models

1 file changed

+4
-5
lines changed

aspnetcore/tutorials/first-mvc-app/start-mvc/sample/MvcMovie90/Models/Movie.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,15 @@ public class Movie
117117
{
118118
public int Id { get; set; }
119119
[StringLength(60, MinimumLength = 3)]
120-
public string Title { get; set; }
120+
public string? Title { get; set; }
121121
[Display(Name = "Release Date"), DataType(DataType.Date)]
122122
public DateTime ReleaseDate { get; set; }
123123
[RegularExpression(@"^[A-Z]+[a-zA-Z\s]*$"), Required, StringLength(30)]
124-
public string Genre { get; set; }
125-
[Range(1, 100), DataType(DataType.Currency)]
126-
[Column(TypeName = "decimal(18, 2)")]
124+
public string? Genre { get; set; }
125+
[Range(1, 100), DataType(DataType.Currency), Column(TypeName = "decimal(18, 2)")]
127126
public decimal Price { get; set; }
128127
[RegularExpression(@"^[A-Z]+[a-zA-Z0-9""'\s-]*$"), StringLength(5)]
129-
public string Rating { get; set; }
128+
public string? Rating { get; set; }
130129
}
131130
// </snippet_AttrOneLine>
132131
#endif

0 commit comments

Comments
 (0)