Hi I have spent hours trying to work out how to do this one.
So lets say I have two models:
model 1 - AccountInformation
model 2 - AccountHoldersImages
One account holder can have many images. I am trying to achieve on the accountInformation create view (using Scaffolding) to include the facility to add the images at the same time of creation of the user account. Is this possible?
One account holder can have many images
In which case, AccountHoldersImages must be a part of AccountInformation.
If in different views you are using AccountHoldersImages separately, then may be you can keep the view models separate.
However, for this particular view that you are talking about, you will have to wrap the view models into a single view model as MelancialUK commented above.
Another way is to pass the models as part of ViewData[]. If it is a form, then on post you can use FormCollection parameter of your [HttpPost] action to get your images.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.