Skip to content

Instantly share code, notes, and snippets.

@thinkdevcode
Last active December 15, 2015 09:39
Show Gist options
  • Save thinkdevcode/5240466 to your computer and use it in GitHub Desktop.
Save thinkdevcode/5240466 to your computer and use it in GitHub Desktop.
public class Main : NancyModule
{
public Main()
: base("/v1/vision")
{
Get["/{dbo}/{table}"] = _ =>
{
var db = Database.OpenNamedConnection("VisionDev");
int page = (Request.Query.page) ? Request.Query.page : 1;
List<dynamic> list = db[_.dbo][_.table].All().Skip(page * 20).Take(20).ToList();
return Response.AsJson(list);
};
}
}
@thinkdevcode
Copy link
Author

Should add paging and stuff to this to make it more robust

@thinkdevcode
Copy link
Author

Paging added and fixed a bug in simple.data.sqlserver in the process lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment