Last active
August 29, 2015 13:56
-
-
Save khellang/8851016 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 MyModule : NancyModule | |
| { | |
| public MyModule() | |
| { | |
| Post["/scores"] = _ => | |
| { | |
| var queries = this.Bind<IEnumerable<QueryParameters>>(); | |
| return queries.Select(GetResult); | |
| } | |
| Get["/scores"] = args => | |
| { | |
| var query = new QueryParameters | |
| { | |
| StartDate = args.startDate, | |
| EndDate = args.endDate, | |
| Team = args.team; | |
| } | |
| return GetResult(query); | |
| } | |
| } | |
| private Result GetResult(QueryParameters parameters) | |
| { | |
| // Get some results | |
| } | |
| } | |
| public class QueryParameters | |
| { | |
| public DateTimeOffset StartDate { get; set; } | |
| public DateTimeOffset EndDate { get; set; } | |
| public string Team { get; set; } | |
| } | |
| public class Result | |
| { | |
| // Watever you want to return here... | |
| } |
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
| [{ | |
| startDate: 01-04-2013, | |
| endDate: 01-05-2013, | |
| team: "Jets" | |
| }, | |
| { | |
| startDate: 01-04-2013, | |
| endDate: 01-05-2013, | |
| team: "Cowboys" | |
| }] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment