Created
December 1, 2012 19:49
-
-
Save NTCoding/4184509 to your computer and use it in GitHub Desktop.
Raven_create
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 Post | |
| { | |
| private readonly IDocumentSession session; | |
| private readonly ISecurityContext security; | |
| public Post(IDocumentSession session, ISecurityContext security) | |
| { | |
| this.session = session; | |
| this.security = security; | |
| } | |
| public FubuContinuation Handle(AddLifeLessonInput input) | |
| { | |
| var lesson = new LifeLesson | |
| { | |
| Title = input.Title, | |
| Description = input.Description, | |
| Tags = input.Tags.Select(x => x.Text.Trim()).Distinct().Select(l => new Tag {Name = l}).ToList(), | |
| Importance = input.Importance, | |
| Motivation = input.Motivation, | |
| CreatedDate = DateTime.Now, | |
| UserId = security.CurrentIdentity.Name, | |
| Slug = GetSlugFor(input.Title) | |
| }; | |
| session.Store(lesson); | |
| return FubuContinuation.RedirectTo(new AddRehearsalPlanRequest { Lesson = lesson.Title, LessonId = lesson.Id, LessonSlug = lesson.Slug}); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment