This is using Sitecore 9.0.2 and Glass 5.1.10. I'm trying to figure out the best way to access the IMvcContext (or ISitecoreService) in a view rendering. Using controller rendering is very straightforward, but one of our devs opened the view rendering with IMvcContext mvcContext = new IMvcContext()
which seems unneeded to declare a new context.
I would think there's another way to essentially get the existing context in, but I'm not sure if that's a cast of Sitecore.Context in some fashion, or if that's really the best way. Or, if it would be best practice to switch to a controller rendering if this situation comes up, which is perfectly viable.
IMvcContext
into the controller and use it that way. Don't try and do that in a view rendering.