Creating the Model

Most projects start with the model. For this application, I am working with a preexisting database, so my model objects will simply represent the database tables. I created a new folder called Models/Domain and created the model classes. Listing 31-1 shows the Event class, which will represent rows of data in the Events database table.

Listing 31-1. The Event domain model class

using System; namespace TriathlonApp.Models.Domain {     public class Event {         public int ID { get; set; }         public DateTime Date { get; set; }         public string Athlete { get; set; }         public string Type { get; set; }         public TimeSpan SwimTime { get; set; }         public TimeSpan CycleTime { get; set; }         public ...

Get Applied ASP.NET 4 in Context now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.