Created
December 1, 2012 20:52
-
-
Save NTCoding/4184996 to your computer and use it in GitHub Desktop.
raven_query
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 Get | |
| { | |
| private readonly IDocumentSession session; | |
| private readonly ISecurityContext security; | |
| public Get(IDocumentSession session, ISecurityContext security) | |
| { | |
| this.session = session; | |
| this.security = security; | |
| } | |
| public ViewLessonViewModel Handle(ViewLessonRequest request) | |
| { | |
| var lesson = session | |
| .Query<LifeLesson>() | |
| .ForLoggedInUser(security) | |
| .Where(l => l.Slug == request.Lesson) | |
| .ToList().Single(); | |
| var plan = session | |
| .Query<RehearsalPlan>() | |
| .Where(p => p.LessonId == lesson.Id) | |
| .Customize(x => x.WaitForNonStaleResultsAsOfLastWrite()) | |
| .FirstOrDefault(); | |
| return new ViewLessonViewModel{Lesson = lesson, RehearsalPlan = plan}; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment