我有一个有3个步骤/ 3个视图的向导,每个View都有自己的ViewModel,我需要插入一个提交来自3个视图的所有信息。
所有视图都使用Html.RenderAction方法包含在主视图中。
@:<!--- Step1 --->
<div class="company-add-step5-elements-container">@{ Html.RenderAction(MVC.Company.CreateS1NameAddress()); }</div>
@:<!--- Step2 --->
<div class="company-add-step2-elements-container">@{ Html.RenderAction(MVC.Company.CreateS2Services()); }</div>
@:<!--- Step3 --->
<div class="company-add-step3-elements-container">@{ Html.RenderAction(MVC.Company.CreateS3Schedule()); }</div>
Step1的ViewModel:
// Primary properties
[Required(ErrorMessageResourceName = "ErrorMsgRequiredField", ErrorMessageResourceType = typeof(HeelpResources))]
public string CompanyName { get; set; }
public string Telephone { get; set; }
Step2的ViewModel:
[Display(ResourceType = typeof(HeelpResources), Name = "AddressViewModelAddressLabel")]
public string Address1 { get; set; }
public string Address2 { get; set; }
Step3的ViewModel:
[Display(ResourceType = typeof(HeelpResources), Name = "AddressViewModelCityLabel")]
public string City { get; set; }
现在我如何创建一个ViewModel来提交所有步骤:
public class CompanyCreateViewModel
{
// How can I merge everything here without repeating all the properties?
}
由于