Using two models in a single view
ASP.NET
1
Posts
1
Posters
8
Views
1
Watching
-
I need to use two models in a single view. The models are "AppUser" and "PM". I created a View model as follows:
public class PageViewModel
{
public PM PmModel { get; set; }
public AppUser UserModel { get; set; }
}and used following code in the view:
@model IEnumerable
The problem is that When I run the application, the following error is shown:
Quote:
InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1[CustomizedIdentity.Models.PM]', but this ViewDataDictionary instance requires a model item of type 'System.Collections.Generic.IEnumerable`1[CustomizedIdentity.ViewModel.PageViewModel]'.
How can I fix this error?