Permalink
Browse files

Trying continuations

  • Loading branch information...
1 parent 469bc2f commit 083e1d593d4e797ac04fb493acd1e29a332cd303 @adymitruk committed Mar 10, 2012
@@ -0,0 +1,8 @@
+<use master="" />
+<viewdata model="FubuMVC.HelloSpark.AdamInputModel" />
+<h2>This is the adam input model</h2>
+<div>!{Model.Message}</div>
+<form model="FubuMVC.HelloSpark.AdamInputModel" >
+ <input id="CreditCard" name="CreditCard" type="text" />
+ <input type="submit" value="Submit" />
+</form>
@@ -0,0 +1,3 @@
+<viewdata model="FubuMVC.HelloSpark.AdamSuccessModel" />
+<h2>This is the adam input model</h2>
+<p>You have successfully entered ${Model.CreditCard}!</p>
@@ -1,17 +1,15 @@
using FubuMVC.Core;
+using FubuMVC.Core.Continuations;
using FubuMVC.Core.Runtime;
using FubuMVC.Core.Security.AntiForgery;
using FubuMVC.Core.UI.Extensibility;
using FubuMVC.Core.Urls;
using FubuMVC.HelloSpark.Controllers.Air;
using FubuMVC.Spark;
-namespace FubuMVC.HelloSpark
-{
- public class HelloSparkRegistry : FubuRegistry
- {
- public HelloSparkRegistry()
- {
+namespace FubuMVC.HelloSpark {
+ public class HelloSparkRegistry : FubuRegistry {
+ public HelloSparkRegistry() {
IncludeDiagnostics(true);
Applies
@@ -21,9 +19,10 @@ public HelloSparkRegistry()
.IncludeClassesSuffixedWithController();
ApplyHandlerConventions();
+ //ApplyConvention<BehaviourConfigurationTest>();
Routes
- .HomeIs<AirRequest>()
+ .HomeIs<AdamInputModel>()
.IgnoreControllerNamespaceEntirely()
.IgnoreMethodSuffix("Command")
.IgnoreMethodSuffix("Query")
@@ -36,12 +35,12 @@ public HelloSparkRegistry()
Views
.TryToAttachWithDefaultConventions()
- .TryToAttachViewsInPackages();
+ .TryToAttachViewsInPackages()
+ .RegisterActionLessViews(x => x.ViewModelType == typeof(AdamSuccessModel));
HtmlConvention<SampleHtmlConventions>();
- Services(s =>
- {
+ Services(s => {
s.FillType<IExceptionHandler, AsyncExceptionHandler>();
s.ReplaceService<IUrlTemplatePattern, JQueryUrlTemplate>();
});
@@ -50,4 +49,20 @@ public HelloSparkRegistry()
.For<AirViewModel>("extension-placeholder", x => "<p>Rendered from content extension.</p>");
}
}
+
+ public class AdamTestController {
+ public FubuContinuation DoSubmission(AdamInputModel adamInputModel) {
+ if (adamInputModel.CreditCard == 0) return FubuContinuation.TransferTo(adamInputModel);
+ if (adamInputModel.CreditCard % 2 == 0) return FubuContinuation.TransferTo(adamInputModel as AdamSuccessModel);
+ adamInputModel.Message = "Please enter an even number!";
+ return FubuContinuation.TransferTo(adamInputModel);
+ }
+ }
+
+ public class AdamSuccessModel : AdamInputModel {}
+
+ public class AdamInputModel {
+ public int CreditCard { get; set; }
+ public string Message { get; set; }
+ }
}

0 comments on commit 083e1d5

Please sign in to comment.