**Model**```csharp public class ExhibitionList { [Required] [MaxLength(50)] public string ExhibitionName { get; set; }
public DateTime CreateDate { get; set; }
public DateTime EditDate { get; set; } }
Controller```csharp public ActionResult ExhibitionList() { var tuple = new Tuple<IEnumerable, ExhibitionList>(Repository.GetExhibitionList(), new ExhibitionList()); return PartialView(tuple); }
第二種方式就是建立一個ViewModel的方式 Model```csharp /// 展覽列表的ViewModel public class ExhibitionListViewModel { public IEnumerable IEmumerable_ExhibitionList { get; set; } public ExhibitionList ExhibitionListModel { get; set; } }
1 2 3 4 5 6 7 8 9
**View**```csharp public ActionResult ExhibitionList() { ExhibitionListViewModel model = new ExhibitionListViewModel(); model.IEmumerable_ExhibitionList = Repository.GetExhibitionList(); model.ExhibitionListModel = new ExhibitionList(); return PartialView(model); }