Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
public ActionResult Archive(int year, int? month, int? day)
RavenQueryStatistics stats;
var postsQuery = RavenSession.Query<Post>()
.Include(x => x.AuthorId)
.Statistics(out stats)
.Where(post => post.PublishAt.Year == year);
if (month != null)
postsQuery = postsQuery.Where(post => post.PublishAt.Month == month.Value);
if (day != null)
postsQuery = postsQuery.Where(post => post.PublishAt.Day == day.Value);
var posts =
postsQuery.OrderByDescending(post => post.PublishAt)
.Paging(CurrentPage, DefaultPage, PageSize)
return ListView(stats.TotalResults, posts);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.