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
- Find products that the user selected or removed and compare with existing records.
- Add or delete that collection to category object.
- Call SaveCategory(category); // BLL CALL
Here the first 2 process steps occurs in the controller.
(B) It is the responsibility of BLL then pseudo Code would be
- Collect products what ever user selected
- SaveCategory(category, products); // BLL CALL
Here it's up to the SaveCategory (BLL) to decide what products should be removed and added to the database.
Thanks