public IEnumerable<dynamic> GetHotPosts() { //The dataset isn't recent, so we get to fake some dates! DateTime WhenItAllBegins = new DateTime(2011, 3, 25, 0, 0, 0); dynamic table = new Post(); var hotposts = table.Query(@"With hotposts as ( select p.postid, p.answercount,p.viewcount,p.title,p.tags, p.owneruserid from posts p where p.posttypeid = 1 and p.creationdate >= '03-31-2011' order by p.viewcount desc limit 20) Select post.postid, post.answercount,post.viewcount,post.title,post.tags,u.userid,u.displayname,u.reputation FROM hotposts as post inner join users u on post.owneruserid = u.userid"); return hotposts ; }
public IEnumerable<dynamic> GetRecentPosts() { dynamic table = new Post(); var recentposts = table.Query(@"select p.postid, p.answercount,p.viewcount,p.title,p.tags,u.userid,u.displayname,u.reputation from posts p inner join users u on p.owneruserid = u.userid where p.posttypeid = 1 order by p.creationdate desc limit 20"); return recentposts; }