Click here to Skip to main content
15,850,685 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
first question where can I find a excellent book on MVC, LINQ, Entity Framework. Not a beginners book. I have to join 12 tables on to on view page. I am having problems.

Here is what I have accomplished.Created a MVC form that allows input of customer data this works everything saves. I have created a query with LINQ to display all save data into a table grid. The two problems I am having is on the table grid view I have the
@Html.ActionLink("Details", "Details", new { id = item.PatientsId })
So I can choose what record to edit or view the details.

This works for one model

C#
var patients = ((from p in _db.Patients
                              select new PatientsModel()
                                          {
                                               PatientsId = p.PatientsId,
                                               ClientID = p.ClientID,
                                               DOB = p.DOB,
                                               Gender = p.Gender,
                                               Handedness = p.Handedness,
                                               RecordingDate = p.RecordingDate,
                                               TimeRecording = p.TimeRecording,
                                               EO = p.EO,
                                               EC = p.EC,
                                               Task = p.Task,
                                               Referred_for = p.Referred_for,
                                               Evaluation_Number = p.Evaluation_Number,
                                               Years_of_Education = p.Years_of_Education.Value,
                                               Marital_Status = p.Marital_Status,
                                               Abnormality = p.Abnormality,
                                               Vision = p.Vision,
                                               Appearance = p.Appearance,
                                               Sleep_Disorder = p.Sleep_Disorder,
                                               Accident = p.Accident,
                                               Employed = p.Employed,
                                               Veteran = p.Veteran,
                                               Activities = p.Activities,
                                               FileUrl = p.FilesUrl,
                                          }).SingleOrDefault(i => i.PatientsId == id));


             return View(patients);

which represents one table. I have 11 more that need to populate rest of the form.

Any help will be appreciated.

The other 11 tables or models are(MedicalBackgroundModel,PsycologicalModel, CurrentMoodModel, DietInformationModel, BehaviorModel, MedicationModel, SupplementsInformationModel, AssessmentModel, NeurofeedbackModel, OtherDataModel, NarrativeModel )


Thanks,
Posted
Updated 30-Mar-12 12:16pm
v2

I recreated my class to include the tables.

Not something I wanted to do but it works.
 
Share this answer
 
SQL
I recreated my class to include the tables.

Not something I wanted to do but it work
 
Share this answer
 
You can use the collection to solve this problem
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900