| モバイル MVC スキャフォールディングの使用 > 手順 2:モデルの追加 |
以下のコードを追加してアプリケーションのモデルを作成します。
C# コードの書き方
| C# |
コードのコピー
|
|---|---|
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Security; using System.ComponentModel.DataAnnotations; |
|
C# コードの書き方
| C# |
コードのコピー
|
|---|---|
using System;
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; }
}
}
|
|
次の手順では、プロジェクトにコントローラーを追加します。