I have a web application, where on a number of different pages, the user is able to upload, download, or delete files. The action methods for these operations are very similar among the different controllers, with the exception that they utilize different file management services, which all implement a common interface.
I was thinking of refactoring the code by placing the upload, download and delete methods in a generic file management controller, which can be used from the various views.
The difficulty I face, is that the correct file management service would have to be injected somehow, dependent on the current page (or route).
Is there a clean way this can be done in ASP.NET MVC 4?