Place where methods of CRUD interaction with the bank should be in ASP.NET MVC

0

I'm using the entity framework and developing a system through ASP.NET MVC5, but I was in doubt about CRUD.

The methods of interaction with the bank (Create, Update, Select, Delete) should be inserted in which part of the project? I thought of describing each of these functions within the Model classes, but it does not seem right to me.

Another doubt ... is it right to create a generic CRUD interface for all models?

    
asked by anonymous 11.12.2014 / 12:17

1 answer

2

The methods of interaction with the bank (Create, Update, Select, Delete) should be inserted in which part of the project? I thought of describing each of these functions within the Model classes, but it does not seem right.

Totally incorrect, especially since you are using the Entity Framework, which already implements a repository and makes this work unnecessary.

I defend this in these two answers:

The Model is the class that represents the data within your application, and only that .

Another doubt ... the right thing is to create a generic CRUD interface for all models?

Wrong. The right thing is for you to use the Scaffolding technique, which generates a Controller for you with CRUD operations implemented by Action. View this another answer in which I detail this better .

    
11.12.2014 / 17:34