Created
March 15, 2012 19:39
-
-
Save jmarnold/2046344 to your computer and use it in GitHub Desktop.
Fubu transfers
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 TermsRedirectBehavior : BasicBehavior | |
{ | |
private readonly IFubuRequest _request; | |
private readonly IUrlRegistry _urlRegistry; | |
private readonly IOutputWriter _outputWriter; | |
private readonly IPartialFactory _factory; | |
public TermsRedirectBehavior(IFubuRequest request, IUrlRegistry urlRegistry, IOutputWriter outputWriter, IPartialFactory factory) | |
: base(PartialBehavior.Executes) | |
{ | |
_request = request; | |
_urlRegistry = urlRegistry; | |
_outputWriter = outputWriter; | |
_factory = factory; | |
} | |
protected override DoNext performInvoke() | |
{ | |
var registerAccountInput = _request.Get<RegisterAccountInput>(); | |
if (registerAccountInput.ViewTerms != "") // this checks if the terms button was hit instead of the regular register button | |
{ | |
var termsAndConditionsInput = TermsAndConditionsInput.MapFrom(registerAccountInput); | |
// Explicitly set this so that model binding does not kick in | |
_request.Set(termsAndConditionsInput); | |
// build up the behavior chain for TermsAndConditionInput, then invoke it (as a partial because you don't need all the additional behaviors) | |
_factory | |
.BuildPartial(typeof(TermsAndConditionsInput)) | |
.InvokePartial(); | |
return DoNext.Stop; | |
} | |
return DoNext.Continue; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment