Created
October 27, 2012 14:04
-
-
Save CoreyKaylor/3964743 to your computer and use it in GitHub Desktop.
Creating a diversion
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 AcceptPrivacyPolicyRedirector : IActionBehavior | |
{ | |
private readonly ISession _session; | |
private readonly IFubuRequest _fubuRequest; | |
private readonly IContinuationDirector _continuationDirector; | |
private readonly IActionBehavior _inner; | |
public AcceptPrivacyPolicyRedirector(ISession session, IFubuRequest fubuRequest, IContinuationDirector continuationDirector, IActionBehavior inner) | |
{ | |
_session = session; | |
_fubuRequest = fubuRequest; | |
_continuationDirector = continuationDirector; | |
_inner = inner; | |
} | |
public void Invoke() | |
{ | |
//This wires up fubu's model binding to pull data we need from the request, etc. | |
var input = _fubuRequest.Get<UserRequestInputModel>(); | |
var userAccount = _session.Get<UserAccount>(input.UserName); | |
if(userAccount.HasAcceptedPrivacyPolicy) | |
{ | |
_inner.Invoke(); | |
} | |
else | |
{ | |
_continuationDirector.RedirectTo(new AcceptPrivacyPolicyInputModel()); | |
} | |
} | |
public void InvokePartial() | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment