使用用户定义的类型装饰视图模型

时间:2011-09-12 14:56:55

标签: asp.net-mvc-3 viewmodel

这是我的视图模型。我想装饰我的房产。其中regionLists是下拉列表和UnAssignedStatesLists,AssignedStatesLists是列表框。应选择RegionLists ddl,并且至少应将一个项目从UnAssignedStatesLists移动到AssignedStatesLists。我该如何装饰它们?

public class RegionOrStateAssignmentModel : IRegionOrStateAssignmentModel
{
    #region Constructor / Destructor
    public RegionOrStateAssignmentModel()
    {
        RegionLists = new List<IRegion>();
        UnAssignedStatesLists = new List<ICode>();
        AssignedStatesLists = new List<ICode>();
    }
    ~RegionOrStateAssignmentModel()
    {
        RegionLists = null;
        UnAssignedStatesLists = null;
        AssignedStatesLists = null;
    }
    #endregion

    #region Properties
    public List<IRegion> RegionLists { get; set; }
    public IRegion RegionSelected { get; set; }
    public List<ICode> UnAssignedStatesLists { get; set; }
    public List<ICode> AssignedStatesLists { get; set; }
    #endregion
} 

其中IRegion如下

public interface IRegion
{
    int RegionId { get; set; }
    string Name { get; set; }
    string Description { get; set; }
    ICode Status { get; set; }
    string CreatedBy { get; set; }
    DateTime CreateDate { get; set; }
    string ModifiedBy { get; set; }
    DateTime ModifiedDate { get; set; }
    List<ICode> States { get; set; }
}

0 个答案:

没有答案