asp.net-mvcasp.net-mvc-4data-access-layerbusiness-layer

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


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


Solution

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