Mark Tabor

Mark Tabor

  • 589
  • 2k
  • 460.2k

Model binding with index view in mvc

Oct 17 2019 3:47 AM
Hi i have a simple question , I have a class with name Registration in which i have 8 properties and all are quired fields , not this model is binded to the view and it works fine , Now the issue is i want to have the same model bind to another view but on another view i just have four properties and when i tried to bind the existing model with this new view it gives validation error and in my model class i have 8 propertise and all are required but in this view i need just four so what to do in this case , if i need to create a seperate model then how do link this new model with previous one .
 
{ BECAUSE both model are using same Registration table } it gives this error
 
The entity types 'Registration' and 'UserModelForActivation' cannot share table 'Registrations' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them.
 
both medoel are decorated with  [Table("Registration")]
 
 

Answers (3)