Insert (Save) data with parent child relationship in ASP.Net Core MVC

trisetia302
 
on Jul 21, 2021 11:41 AM
842 Views

Hi Guys,

How to save data with 1 to many relationship in Asp.Net Core Mvc

I'm trying to save data with 1 to many relationship but I'm confused with how to show data in view before save.

For example I have 3 tables :

1. tbl_Student

2. tbl_Book

2. tbl_Rent

When 1 student rent more than 1 book it can be save one time. The scnario data like in table below :

RentCode  StudentID  StudentName  BookID  BookName
RNT00001 STN00001 Andi BOOK000001 BOOK A
      BOOK000002 BOOK B
      BOOK000003 BOOK C
      BOOK000004 BOOK D
      BOOK000005 BOOK E

and soon.

How to save the data above ???

Please guide me, may be any link refrence for learn.

Any help could be much apriciate.

Download FREE API for Word, Excel and PDF in ASP.Net: Download
Andrea
 
on Jul 21, 2021 11:41 AM
Hi @trisetia302,
Please try the following

Insert (Save) data with parent child relationship using Entity Framework in ASP.Net MVC

It might help you.

Cheers Andrea.