I am currently working on a website that requires the ability to overwrite the document.cshtml file so that I can apply a specific CSS-class based on the user\'s current loc
Document.cshtml is a wrapper for the Layout shape. Wrappers don't support alternates. The only way to replace the document.cshtml template selectively is to remove the existing wrapper from the wrappers collection on the metadata of the layout shape and add your own.
But wait... I can't think of any good reason why you'd want to do that. What's in document.cshtml is boilerplate HTML that should be the same across the site. The solution described in your update is the way to go.
You could also move the <body>
tag into Layout.cshtml, and then use URL alternates of Layout.cshtml to set the <body>'s
class attribute.
You might want to take a look at this post: http://weblogs.asp.net/bleroy/archive/2010/12/14/switching-the-layout-in-orchard-cms.aspx. It shows how you can dynamically add your own alternates, but the same approach could work to add properties to the model or layout based on geolocation.
I think you can define some code within OnResultExecuting() to dynamically add a property to the Model class. Since it's of type dynamic you should just be able to set it, nothing special needed.