Skip to content Skip to sidebar Skip to footer

Invalidoperationexception: The Model Item Passed Into The Viewdatadictionary Is Of Type 'system.int32'

I'm having trouble presenting the data for a specific table element. The program allows login and logout. so I have the Personal Trainer class [Table('Personal_trainer')] publi

Solution 1:

The error is obvious: You need to send a Model type to your View but you are sending an int which is id in your case. Since you need to show the trainer profile in your View, you would need to change the model type to:

WebApplication1.Models.PersonalTrainer 

in your View and

return View(personalTrainer) 

in your Controller

Post a Comment for "Invalidoperationexception: The Model Item Passed Into The Viewdatadictionary Is Of Type 'system.int32'"