Can we have business logic in controller?

Can we have business logic in controller?

For non trivial applications, business logic/business rules/data access should not be placed directly into Models, Views, or Controllers. To do so would be placing business logic in your presentation layer and thus reducing reuse and maintainability of your code.

What is a controller job salary?

According to the Bureau of Labor Statistics, as of May 2019 the median annual income for a controller (listed as financial managers) is $129,890. 2 However, this is just the median number, and among the 50% who make more than this, many make a lot more.

How is business logic as a separate layer?

ASP.NET MVC: Business Logic as a Separate Layer ASP.NET MVC offers a great way of how to separate different application layers. View layer is responsible for data representation, the controller layer is responsible for receiving and replying to requests, and models are used as two-way information carriers between the previous two layers.

How much business logic should be allowed in the controller?

If there is business logic shared between controller and model the two layers are no longer separable, and someone inheriting the code may be confused by this unevenness in location of business logic related code. My question is how much business logic should be allowed in the controller and in what circumstances, if any?

Where does business logic live in an application?

Domain layer. This is where the business logic lives. This layer makes a use of injectable repositories and is responsible for the majority of business logic. This is the core of the application that we will test thoroughly.

How is business logic should be in a distributed architecture?

The data layer should only understand basic CRUD operations, and the UI layer should deal only with the mapping of presentation DTOs to and from the business objects. In an RPC-style distributed architecture (SOAP, UDDI, BPEL, etc.), the service is the logical version of a physical endpoint.