I have recently been writing controllers for specific pages... so let's say we have 2 controllers:
HomeController
JamesController
On the Home page, I have a dropdown list that contains all James items... On the James list page, I have a dropdown list that contains all James items...
Evidently, I'm gonna be using the same code to get a full list of James back and present it to a view:
public ViewResult List()
{
IEnumerable<James> jamesList = repository.James();
return View(jamesList);
}
What's the usual practice for re-usable bits of code like that? Do you have 2 methods doing the same job where they are required... or do you have ANOTHER called JamesDropDownController and just call upon that from within the 2 views that the 2 controllers are pushing data to?