Reputation: 1
I have a 3 layer design. (UI / BLL / DAL)
UI = ASP.NET MVC
In my view I have collection of products for a category. Example: Product 1, Product 2 etc..
A user able to select or remove (by selecting check box) product’s from the view, finally save as a collection when user submit these changes.
With this 3 layer design how this product collection will be saved? How the filtering of products (removal and addition) to the category object?
Here are my options.
(A) It is the responsibility of the controller then the pseudo Code would be
Here the first 2 process steps occurs in the controller.
(B) It is the responsibility of BLL then pseudo Code would be
Here it's up to the SaveCategory (BLL) to decide what products should be removed and added to the database.
Thanks
Upvotes: 0
Views: 55
Reputation: 16752
The logic should live in the business layer and not the controller. Your controller should be as thin as possible and just orchestrate communication between the view and the other layers that deal with your models and business requirements.
Upvotes: 1