实现所需的ASP.NET MVC复杂视图 [英] Implementation Required ASP.NET MVC Complex Views

查看:59
本文介绍了实现所需的ASP.NET MVC复杂视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是MVC框架的新手。以下是我的问题。因为我是这个框架的新手,请详细说明如何实现它。



1)是否可以通过单个从这些表中检索所有数据查看。



2)如果是,那么产生这种观点的程序是什么。



3)图表的视图代码是什么。



4)最后一个问题:在单个提交按钮上如何将所有这些数据传递给控制器​​以添加它到数据库。皱眉



我真的很感激,如果有人可以帮我解决这个问题。



我正在使用< b> Asp.net MVC5 , EF6 数据库优先



数据库图: - http://i.stack.imgur.com/uthtl.png

I am new to MVC framework. below are my questions. as I'm new to this framework, Please give a detail info how to achieve it.

1) Is it possible to retrieve all the data from these tables through single view.

2) If yes then what will be the procedure to generate such kind of view.

3) what will be the view code of the diagram.

4) Last question : on a single submit button how to pass all these data to controller to add it to the database. Frown

I would really appreciate if anyone can help me out on this.

I am using Asp.net MVC5, EF6(Database first)

Database Diagram:- http://i.stack.imgur.com/uthtl.png

推荐答案





您可以在MVC中使用ViewModel概念。创建一个包含所有必需表作为属性的视图模型,并将值设置为该属性。您可以将新的ViewModel传递给视图,以便所有模型(表格)都在单个视图中。



您可以跟进本文 ASP.NET MVC 4 / MVC 5视图中的多个模型 [ ^ ]



当您将模型绑定到视图为强绑定时,您可以使用相同的模型来更新或者您也可以使用FormCollection。
Hi,

You can use the ViewModel concept in the MVC. Create a view model with all the required tables as the properties and set the values to the property. You can pass the new ViewModel to the view, so that all the models(tables) are in the single View.

You can follow up this article Multiple Models in a View in ASP.NET MVC 4 / MVC 5[^]

As you bind the model to the View as strongly bind, you can use the same model to update or you can use the FormCollection too.


这篇关于实现所需的ASP.NET MVC复杂视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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