【发布时间】:2012-02-10 15:52:33
【问题描述】:
我正在创建一个简单的待办事项应用程序,它有两个实体,tasks 和 categories。
要创建task,必须选择category。为此,我想我需要一个 ViewModel。
这里是任务实体
public class Task
{
public int taskId { get; set; }
public int categoryId { get; set; }
public string taskName { get; set; }
public bool isCompleted { get; set; }
public DateTime creationDate { get; set; }
public DateTime completionDate { get; set; }
public string remarks { get; set; }
public string completionRemarks { get; set; }
}
这是类别实体
public class Category
{
public int categoryId { get; set; }
public string categoryName { get; set; }
}
如何设计TaskCategoryViewModel,以便在CreateTask 视图中绑定category?
编辑:我使用的是经典的 ADO.NET,而不是 Entity Framework 或 LINQ to SQL。
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-2 viewmodel