ASP.NET MVC c#CRUD BuitIN [英] ASP.NET MVC c# CRUD BuitIN

查看:85
本文介绍了ASP.NET MVC c#CRUD BuitIN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


对于ASP.ET MVC ......



在市场上,我看到很多不同的选项来代码表格/ GridView上的CRUD操作。


比如使用jquery,datatables,bootstrap,扩展类..... couple其中甚至来自免费的开源GIT项目。



我对CRUD操作完全感到困惑,要对其进行单行和多行编辑我的MVC c#项目。


我很难理解哪个方向是正确的 微软的方向是什么....就像他们在gridview / datagrid控件中提供的旧webforms以及支持CRUD的内置功能一样。


是否有任何内置的内容MVC或类似的任何东西。如果现在对我来说最近的解决方案是什么。



谢谢。


-


Arya

解决方案

我对在MVC c#项目中要执行的CRUD操作单行和多行编辑感到困惑。


首先,您需要了解MVC, UI设计模式。


https://www.codeproject.com/Articles/228214/Understanding-Basics-of-UI-Design-Pattern-MVC- MVP


https://en.wikipedia.org/wiki/Separation_of_concerns


https://www.c-sharpcorner.com/UploadFile/56fb14/understanding-separation-of-concern- and-Asp-Net-mvc /


https ://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/overview/understanding-models-views-and-controllers-cs



<复制>



MVC模型包含视图或控制器中未包含的所有应用程序逻辑。该模型应包含所有应用程序业务逻辑,验证逻辑和数据库访问逻辑。



A视图应仅包含与生成用户界面相关的逻辑。控制器应该只包含返回正确视图或将用户重定向到另一个操作所需的最小逻辑(流控制)。其他所有内容都应该包含在模型中。$ / b>

一般情况下,你应该努力胖模特和瘦小的控制器。您的控制器方法应该只包含几行代码。如果控制器动作太胖,那么你应该考虑将逻辑移到Models
文件夹中的新类。



< end>



https ://www.upgrad.com/blog/mvc-architecture-in-java/



<复制>



MVC架构模式遵循基本理念 - 我们必须分担责任在以下任何应用程序中:



1)模型:处理数据和业务逻辑。 />
2)视图:在需要时向用户显示数据。

3)控制器:接受用户请求并获取必要的资源。



首先,"pens_controller.php"将用户请求(1)作为GET或POST请求处理。我们还可以有一个"index.php",它是中央控制器,可以在需要时调用"pens_controller"。





现在,模型搜索数据库如有必要,请在必要时应用逻辑,并将数据返回给控制器。


然后控制器选择一个合适的视图(5)并显示数据(6和7)。如果请求来自手持设备,将使用适合它的视图,或者如果用户选择了特定主题,则会选择其视图 - 依此类推。



< end>


我正在努力了解哪个方向是对的 微软的方向是什么......就像他们在gridview / datagrid控件中提供的旧webforms以及支持CRUD的内置功能一样。


使用Visual Stuido在ASP.net MVC中有一些Mr. Wizard的东西,但它不是那个,而且  ASP.NET MVC以CRUD的实体框架为中心。


https://dzone.com/articles/reasons-move-datatables


可以在ASP.NET论坛上讨论ASP.NET MVC


https://forums.asp.net /



Hi Guys,

For ASP.ET MVC...

Out in the market, I see lot of different options to code for a CRUD operations on table/GridView.

like using jquery, datatables, bootstrap, extension classes..... couple of them even come from free open source GIT projects.

I am totally confused about CRUD operation single and multi edit of rows to be performed in my MVC c# project.

I am struggling to understand which direction is right  and what is the direction from Microsoft.... like in old webforms they provided built in gridview/datagrid control and also in built functionality to support CRUD.

Is there anything that is inbuilt in MVC or anything close like that. If now what is the nearest solution for me.

Thank you.

-

Arya

解决方案

I am totally confused about CRUD operation single and multi edit of rows to be performed in my MVC c# project.

First you need to understand MVC, a UI design pattern.

https://www.codeproject.com/Articles/228214/Understanding-Basics-of-UI-Design-Pattern-MVC-MVP

https://en.wikipedia.org/wiki/Separation_of_concerns

https://www.c-sharpcorner.com/UploadFile/56fb14/understanding-separation-of-concern-and-Asp-Net-mvc/

https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/overview/understanding-models-views-and-controllers-cs

<copied>

An MVC model contains all of your application logic that is not contained in a view or a controller. The model should contain all of your application business logic, validation logic, and database access logic.

A view should contain only logic related to generating the user interface. A controller should only contain the bare minimum of logic required to return the right view or redirect the user to another action (flow control). Everything else should be contained in the model.

In general, you should strive for fat models and skinny controllers. Your controller methods should contain only a few lines of code. If a controller action gets too fat, then you should consider moving the logic out to a new class in the Models folder.

<end>

https://www.upgrad.com/blog/mvc-architecture-in-java/

<copied>

MVC architectural pattern follows an elementary idea – we must separate the responsibilities in any application on the following basis:

1) Model: Handles data and business logic.
2) View: Presents the data to the user whenever asked for.
3) Controller: Entertains user requests and fetch necessary resources.

First, the "pens_controller.php" handles the user request (1) as a GET or POST request. We can also have an "index.php" which is the central controller which will call the "pens_controller" whenever needed.

The controller then examines the request and the parameters and calls the required model – in this case, "pens_model.php". The controller asks the model to return the list of available pens.

Now, the model searches the database for the necessary information , applies logics if necessary, and returns the data to the controller.

The controller then picks an appropriate view (5) and presents the data (6 and 7). If a request comes from a handheld device, a view suitable for it will be used, or if the user has a particular theme selected, its view will be picked – and so on.

<end>

I am struggling to understand which direction is right  and what is the direction from Microsoft.... like in old webforms they provided built in gridview/datagrid control and also in built functionality to support CRUD.

There is some Mr. Wizard stuff in ASP.net MVC using Visual Stuido, but it's not about that, and  ASP.NET MVC is centered around Entity Framework for CRUD.

https://dzone.com/articles/reasons-move-datatables

ASP.NET MVC can be discussed at the ASP.NET forums

https://forums.asp.net/


这篇关于ASP.NET MVC c#CRUD BuitIN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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