Back to list
Views:   0
Replies:  0
Reply 1

Indeed, the lines between the different layers can become fuzzy. 

In its simplest form, the business layer has just business objects. 
If you need to apply more complex business rules, you can write this in one of these places:  

1) in the controller action method (or code behind), or
2) in a separate service layer if the rule needs to be reusable. 

To go back to your example you gather all the information in a postback action method and determine if the discount applies. If so, save the appropriate information back to the database (one or more objects/tables). If not return an error message to the user.

Alternatively, you can write an ApplyDiscount method in a Service layer (a class named Service) and do the work there.  
Call this method from the controller's action method (or code behind).  This method is then callable from other places as well.

Choose whatever approach is best for you.  

Hope this helps.


Jack Poorte, Mar 02, 2015
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas