Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created June 23, 2016 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcomartin/ac37d5505e0345e828ba740f5ebca939 to your computer and use it in GitHub Desktop.
Save dcomartin/ac37d5505e0345e828ba740f5ebca939 to your computer and use it in GitHub Desktop.
public class RouteLinker
{
private readonly IResourceLinker _linker;
private readonly NancyContext _context;
public RouteLinker(IResourceLinker linker, NancyContext context)
{
_linker = linker;
_context = context;
}
public string BuildAbsoluteRoute(Route route, dynamic parameters = null)
{
return _linker.BuildAbsoluteUri(_context, route.Name, parameters).ToString();
}
public string BuildRelativeRoute(Route route, dynamic parameters = null)
{
return _linker.BuildRelativeUri(_context, route.Name, parameters).ToString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment