O'Reilly logo

Applied ASP.NET 4 in Context by Adam Freeman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building the Add Event Feature

The user can add a new event to the database by clicking the Add Event button. Before we implement the action method that this button targets, I am going to add some validation and display attributes to the Event model class, as shown in Listing 31-24.

Listing 31-24. Adding display and validation attributes to the Event domain model class

using System; using System.ComponentModel.DataAnnotations; using System.Web.Mvc; namespace TriathlonApp.Models.Domain {     public class Event {         [HiddenInput(DisplayValue=false)]         public int ID { get; set; }         [DataType(DataType.Date)]         public DateTime Date { get; set; }         [Required]         public string Athlete { get; set; }         public ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required