Im working with a project that sets variables such as the current user profile object in its authorize action filter, storing them in the ViewData
for access by the following action method.
The action method then calls functionality from the repository. I'm trying to find a way to access the ViewData
from the repository WITHOUT modifying the repository's method signature, and am hoping there is a way I can track back to it via the HttpContext.Current
functionality which I can call from the repository.
Can anyone help with this? Just to be clear, the only code that I can modify is within the repository method :(
public class MyController : Controller {
[MyAuthorize] // ViewData items are set here
public void MyAction(int id)
{
new MyRepository().DoSomething(id); // Need to access ViewData items within this repository method and am unable to alter the method signature :(
}
}