MVC试图在我的详细信息视图页面上显示多个表. [英] MVC trying to display multiple tables on my detail view page.

查看:110
本文介绍了MVC试图在我的详细信息视图页面上显示多个表.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一个问题,我在哪里可以找到有关MVC,LINQ,实体框架的优秀书籍.不是初学者的书.我必须将12个表连接到视图页面上.我有问题.

这就是我已经完成的工作.创建了一个MVC表单,该表单允许输入客户数据,这可以节省一切.我已经使用LINQ创建了一个查询,以将所有保存的数据显示到表网格中.我遇到的两个问题是在表格网格视图上,我有

@ Html.ActionLink("Details","Details",new {id = item.PatientsId})
因此,我可以选择要编辑或查看详细信息的记录.

适用于一个模型

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

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);


代表一张桌子.我还有11个需要填写表格的其余部分.

任何帮助将不胜感激.

其他11个表或模型是(MedicalBackgroundModel,PsycologicModel,CurrentMoodModel,DietInformationModel,BehaviorModel,MedicationModel,SupplementsInformationModel,EvaluationModel,NeurofeedbackModel,OtherDataModel,NarrativeModel)


谢谢,


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,

推荐答案

我重新创建了包含表的类.

不是我想做的事,但它能工作.
I recreated my class to include the tables.

Not something I wanted to do but it works.


I recreated my class to include the tables.

Not something I wanted to do but it work


您可以使用集合来解决此问题
You can use the collection to solve this problem


这篇关于MVC试图在我的详细信息视图页面上显示多个表.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆