Where to put insert,update, delete methods in asp.net mvc

708 Views Asked by At

I want to ask where to put Insert, update delete methods using stored procedure. as i added class library for Dataaccess and business logic class.. and referenced this class library in my mvc 4 project. Now i want to know where to put insert , update ,delete methods eitherin mvc project model or in class library BL class

2

There are 2 best solutions below

2
On BEST ANSWER

You should put the Insert, update , delete etc methods in the Business layer and in Controller, just call the methods from Business layer. The data access should never interact directly with the Controller or the presentation layer. (These are the good programming ethics since they provide security to the application and data)

0
On

You can don it in where ever like in controller or model or in a separate class itself.

If you using it in Model just method call function is enough form controller. MVC provide as in In-dependency to create our model and db calling methods in different areas.