Visual Studio 2010的MVC中区分模型、视图和控制器
我阅读了 MVC 概念,但我不明白哪种类型的代码应该在控制中,哪种类型应该在模型中。
I read MVC concept, but i dont understand which type of code should be in controll and which one in model.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想你能理解什么是视图。 view 负责显示或 UI。
模型是您定义要在应用程序中作为实体工作的类的部分。
控制器是您编写程序逻辑的类。因此,控制器将使用模型向视图提供数据,使用模型从视图检索数据并执行您编程所需的任何任务。
例如,如果该程序用于图书馆系统,您可以为图书创建一个模型类,如下所示,
控制器类具有查看图书详细信息、创建新书等操作。以下是
我的 示例我想这会帮助你理解这个概念
干杯。
贾扬加。
I thing you can understand what is a view. view is responsible of the display or UI.
Model is the part where you define the classes which you want to work as entities in your application.
Controller is the class which you write your program logic. therefore a controller will provide data to the views using Models, retrieve data from views using Model and perform any task that you program wants.
for example if the program is for a library system you can have a Model class for Book which could look like the following
the controller class has the operations like View details about the book, Create new book, etc.. the following is an example
I think this will help you a little to understand the concept
Cheers.
Jayanga.