Last active
April 3, 2016 18:08
-
-
Save casper-rasmussen/06d48ec3c49d82a863759173164826ca to your computer and use it in GitHub Desktop.
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 FormController : Controller | |
{ | |
private readonly IUnknownActionHandler _xFormActionHandler; | |
private readonly IFormViewModelBuilder _viewModelBuilder; | |
public FormController(IUnknownActionHandler xFormActionHandler, IFormViewModelBuilder viewModelBuilder) | |
{ | |
this._xFormActionHandler = xFormActionHandler; | |
this._viewModelBuilder = viewModelBuilder; | |
} | |
[AcceptVerbs(HttpVerbs.Post)] | |
[ValidateAntiForgeryToken] | |
public virtual ActionResult Index(XFormPostedData xFormpostedData) | |
{ | |
//Submit and Redirect to either Failed or Success | |
return this._xFormActionHandler.HandleAction(this); | |
} | |
#region Success and failed actions | |
[AcceptVerbs(HttpVerbs.Post)] | |
public ActionResult Success(XFormPostedData xFormPostedData) | |
{ | |
FormViewModel viewModel = this._viewModelBuilder.Build(xFormPostedData.XForm, ContentLanguage.PreferredCulture); | |
return PartialView("_Form", viewModel); | |
} | |
[AcceptVerbs(HttpVerbs.Post)] | |
public ActionResult Failed(XFormPostedData xFormPostedData) | |
{ | |
FormViewModel viewModel = this._viewModelBuilder.Build(xFormPostedData.XForm, ContentLanguage.PreferredCulture); | |
return PartialView("_Form", viewModel); | |
} | |
#endregion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment