Akash Patel

Akash Patel

  • 1.6k
  • 21
  • 12.2k

Field to choose for CRUD for tables with foreign keys.

Aug 13 2022 5:33 PM

I am working on a project in ASP.NET MVC Core. I have 3 tables FitnessClass, ClassSession, ClassEnrollee and following are the fields :

1). FitnessClass -> FitnessClassId, Title, Description, MaxEnrollee, Caloriesburned

2). ClassSession-> ClassSessionId, FitnessClassId, ClassSessionStartTime, LocationId

3). ClassEnrollee-> EnrolleId, ClassSessionId, MemberId.

My question is that I want to create CRUD for ClassEnrollee and as mentioned there are 3 fields in which 2 of them are foreign key. So which filed should I use to insert Foreign Key value in ClassEnrollee table in View part of ASP.NET CORE MVC. Is it CalssSessionStartTime or FitnessClass Title field bcoz classSession table has fitnessclassId as foreign key.


Answers (2)