ASP.NET Core Web App (Model-View-Controller):
Right-click on Models ⟹ Add ⟹ New Item... ⟹ C# Class
C:\ASP.NET-workspace\BookStore1\Models\Book.cs
|
using System.ComponentModel.DataAnnotations;
namespace BookStore1.Models {
public class Book {
[ Key ]
[ Required ]
public int Id { get; set; }
[ Display( Name = "Book Title" ) ]
[ Required ]
public string Title { get; set; }
public string Genre { get; set; }
[ DataType( DataType.Currency ) ]
[ Range( 1, 100 ) ]
public decimal Price { get; set; }
[ Display( Name = "Publish Date" ) ]
[ DataType( DataType.Date ) ]
public DateTime PublishDate { get; set; }
}
}
|
|
“It’s amazing how email has changed our lives. You ever get a handwritten letter in the mail today? ‘What the? Has someone been kidnapped?’” — Jim Gaffigan |