Nov 21, 2020
My point is, we should not split logic inside a method using if/else based on the passed Boolean parameter. As a best practice we should not write business logic inside controllers. Therefore you should not handle logic in the controller. What I suggest you is take the argument in the controller and send it to the business/service layer. In that layer you can split the logic to two methods. That’s what we do in Facade pattern. No need to create two endpoints in controller.