I have a solution consisting of several levels: controller> service> business> repository
I study MVC, so I try to follow the recommendations as much as possible. I think the controller should be as light as possible. Let's say we have an βEditβ action in my controller that gets a view model hosted by the corresponding view. This presentation model is the result of the data contained in the model object.
What should I achieve with this view model:
- (1) get the associated object model
- (2) map my view model to my object model (to have an updated and complete object)
- (3) save this updated object
- (4) prepare the notice displayed in the submission
- (5) return to another view
My question is: where should I code all these things?
From my point of view, points 1, 2, 3 should run in the business layer, and points 4 and 5 in the controller layer.
Can you confirm?
Thanks.
source share