Question

What is the best way to invoke an Action-method method in Controller A, from Action-method method in Controller B? Is it true to have such an invocation at all?

Was it helpful?

Solution

Best way is by calling return RedirectToAction().

But the right way to go will be to move the relevant code from your controllers/actions to an outside place, a service or business logic layer. It's wrong that they reside in your controller, it's not the place, and it now causes you headaches how to jump to another controller and then back. It's just wrong. Instead of finding a way to get around, simply fix your architecture.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top