none
ASP.NET MVC c# CRUD BuitIN RRS feed

  • Question

  • 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


    • Edited by Aryaa Wednesday, May 8, 2019 3:34 PM
    • Moved by CoolDadTx Wednesday, May 8, 2019 5:33 PM ASP.NET related
    Wednesday, May 8, 2019 3:33 PM

All replies

  • 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/

    Wednesday, May 8, 2019 4:30 PM
  • Please post questions related to MVC in the ASP.NET forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, May 8, 2019 5:33 PM