Skip to content

Instantly share code, notes, and snippets.

@theClarkSell
Created July 28, 2011 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theClarkSell/1111636 to your computer and use it in GitHub Desktop.
Save theClarkSell/1111636 to your computer and use it in GitHub Desktop.
Consuming an OData Service from WebMatrix
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Consuming an OData Service from WebMatrix</title>
<meta name="author" content="Clark Sell" />
</head>
<body>
<div>
<h2><a href="http://developerSmackdown.com" target=_blank>Developer Smackdown</a></h2>
<p >The latest on <a href="http://developerSmackdown.com/archives/show" target=_blank>Developer Smackdown</a></p>
@DeveloperSmackdown.GetLatestShow()
</div>
</body>
</html>
<body>
<div>
<h2><a href="http://developerSmackdown.com" target=_blank>Developer Smackdown</a></h2>
<p >The latest on <a href="http://developerSmackdown.com/archives/show" target=_blank>Developer Smackdown</a></p>
@DeveloperSmackdown.GetLatestShow()
</div>
</body>
@functions {
public static IList<dynamic> GetRecentShow()
{
return OData.Get(@"http://developersmackdown.com/services/odata/Shows?$orderby=ShowId%20desc&$top=1");
}
}
@helper GetLatestShow() {
var show = DeveloperSmackdown.GetRecentShow();
<p>@show[0].Title</p>
<p>@show[0].Description</p>
<p><a href="@show[0].PublicUri" class="more">Listen Now &raquo;</a></p>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment