Add the following code to create your application Model.
- Right-click the Models folder in the Solution Explorer and choose Add | Class.
- Name the class TahDoList.cs and click Add.
- Ensure that you've referenced the following namespaces. If you don't have some of the namespaces referenced, then add them at the top of your page.
C#
C# |
Copy Code
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.ComponentModel.DataAnnotations; |
- Add the following stored procedures:
C#
C# |
Copy Code
|
public class TahDoList
{
[Editable(false)]
public int Id { get; set; }
[Required]
public string Title { get; set; }
[Display(Name = "Date Created")]
public DateTime? CreatedAt { get; set; }
[Range(0, 5),UIHint("NumericSlider")]
public int Priority { get; set; }
[Range(0, 1000000)]
public decimal Cost { get; set; }
[DataType(DataType.MultilineText)]
public string Summary { get; set; }
public bool Done { get; set; }
[Display(Name = "Date Completed")]
public DateTime? DoneAt { get; set; }
}
} |
- Rebuild your application. This will allow the Scaffolding to inspect our Object Model.
In the next step, you'll add a Controller to your project.
See Also