I have an query parameter in a number of controller actions that I would like to modify in a number of ways before using it.
e.g.
public async Task<ActionResult<Foo>> GetFoo(string imageName)
{
imageName = Uri.UnescapeDataString(imageName);
imageName = RewriteSelfToUserId(imageName); // appends something to the string based on the currently logged in user
.....
}
I would like to put all of this behaviour in one place, I am just unsure what the best way to do it is.
- Using a class - not my favorite because I need some stuff from the request context which I would need to pass in.
Attribute on the string. Probably the same? How can I pass in the current User?
???