Mark Tabor

Mark Tabor

  • 569
  • 1.9k
  • 431.1k

How to save multiple rows into the database in mvc

Dec 28 2019 7:56 AM
hi I have a form in which i have two dropdownlist and two textboxes , these dropdownlist having multiselect options as well , Now i want to save multiple rows for them just see below.
you can see i have selected two teachers and two coruses i want to save four rows into the database like first two rows for the first teacher (For two courses ) and last two rows for the second teachers ( for two courses) 
how to achieve it , i am sharing my model class as well I have not taken courses and teacher as list insted i took them as normal int type .
public int? Course_Id { get; set; }
public int? Teacher_Id { get; set; } 
 

Answers (8)