AspNetCore.Docs/aspnet/mvc/models/validation/sample/Movie.cs

33 lines
679 B
C#

using System;
using System.ComponentModel.DataAnnotations;
namespace MVCMovie.Models
{
public class Movie
{
public int Id { get; set; }
[Required]
[StringLength(100)]
public string Title { get; set; }
[Required]
[ClassicMovie(1960)]
[DataType(DataType.Date)]
public DateTime ReleaseDate { get; set; }
[Required]
[StringLength(1000)]
public string Description { get; set; }
[Required]
[Range(0, 999.99)]
public decimal Price { get; set; }
[Required]
public Genre Genre { get; set; }
public bool Preorder { get; set; }
}
}