Created
July 5, 2012 14:58
-
-
Save jmarnold/3054190 to your computer and use it in GitHub Desktop.
Filters...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RequiresSiteAttribute : ModifyChainAttribute | |
{ | |
public override void Alter(ActionCall call) | |
{ | |
call.AddBefore(ActionCall.For<SiteFilter>(x => x.HasSite())); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SiteFilter | |
{ | |
private readonly ISiteContext _context; | |
public SiteFilter(ISiteContext context) | |
{ | |
_context = context; | |
} | |
public FubuContinuation HasSite() | |
{ | |
return _context.Current == null | |
? FubuContinuation.RedirectTo(new SiteSelectionInput()) | |
: FubuContinuation.NextBehavior(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment