0
Follow
0
View

ASP.NET Razor pages data linking [closed]

wuyi3320 注册会员
2023-01-25 15:00

You can find you are using [Requeired] on public string Description{get;set;} in model Counseller,and you are passing Schedule.Counseller.Description to OnPostAsync in Create page.So when you use _context.Schedule.Add(Schedule),it will also insert the Counseller,and it will get the error cannot insert the value NULL into column Description.

If you want to add the Counseller when adding the Schedule,you need to set default values of Counseller [Required] properties.

About the Author

Question Info

Publish Time
2023-01-25 15:00
Update Time
2023-01-25 15:00