4
Answers

Model or Controller

Photo of Daoudy

Daoudy

8y
972
1
Hi everyone!
In a MVC architecture, should we put our buisness logic in models or controllers?
Thank you. 

Answers (4)

1
Photo of Ayan Roy
NA 350 960 8y
Hi Daoudy ,
I would be better if you create a sperate class Library project and put your all the business logic there and used some for the communication from the controller to DataAccess Layer.
That would make your solution lightly couple . 
0
Photo of Tapan Patel
293 6.3k 423.5k 8y
As other suggested, never do business logic stuff in Models(unless no choice otherwise), try puttling business logic around some libraries and utilize those in Controllers or put it in controller (that is what they are designed to do).
 
 
Putting stuff in models will ruin your design on long run where slight change in logic will create good amount of work to deal with. 
0
Photo of Midhun Tp
146 13.2k 1.5m 8y
Hi,
Business logic should be put inside models. Please go through below threads for detailed explanation for the same -
https://blogs.msdn.microsoft.com/aspnetue/2010/09/17/best-practices-for-asp-net-mvc/
http://blog.iannelson.systems/mvc-where-to-put-business-logic/
http://stackoverflow.com/questions/4415904/business-logic-in-mvc
0
Photo of Delpin Susai Raj
42 34.3k 7.3m 8y
http://programmers.stackexchange.com/questions/176639/why-put-the-business-logic-in-the-model-what-happens-when-i-have-multiple-types