Is it bad practise to call a controller action from a view that was rendered by another controller?
Posted
by
marco-fiset
on Programmers
See other posts from Programmers
or by marco-fiset
Published on 2013-10-24T14:42:11Z
Indexed on
2013/10/24
16:08 UTC
Read the original article
Hit count: 241
programming-practices
|mvc
Let's say I have an OrderController
which handles orders. The user adds products to it through the view, and then the final price gets calculated through an AJAX call to a controller action.
The price calculation logic is implemented in a seperate class and used in a controller action. What happens is that I have many views from different controllers that need to use that particular action. I'd like to have some kind of a PriceController
that I could call an action on. But then the view would have to know about that PriceController and call an action on it.
Is it bad practice for a view to call an action on a different controller from which it was rendered?
© Programmers or respective owner