dimanche 10 mai 2020

How do I create a checkbox in ASP.NET Core and Entity Framework?

I have built a one to money relationship between two models (Student, Course) on ASP.NET Core. Now there is another model called StudentCourse. The names of all the students I have in this StudentCourse model will come from the Student model and show the data through the dropdown list and the courses will come from the Course model and show here in the form of a checkbox.

Now I have been able to fetch data from the Student model and show it in the dropdown list in the view of the StudentCourse model. And I was able to bring the data from the Course model and show it in the checkbox of GET method, but the data from that checkbox is not going to be saved in the database while POST method. What is the reason for this?

I did the whole thing through Entity Framework, so I would be happy to let you know if there is any way to do such a checklist through Entity Framework.

Thanks!




Aucun commentaire:

Enregistrer un commentaire