PageRenderTime 48ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/Source/Samples/Blog/Bifrost.Samples.Blog.Views/Posts/CommentEventSubscriber.cs

#
C# | 24 lines | 23 code | 1 blank | 0 comment | 0 complexity | a6a530ea15d1ae9d674cf85ea262d69c MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. using System;
  2. using Bifrost.Events;
  3. using Bifrost.Samples.Blog.Events.Posts;
  4. namespace Bifrost.Samples.Blog.Views.Posts
  5. {
  6. public class CommentEventSubscriber : EventSubscriber<Comment>
  7. {
  8. public void Process(CommentAdded @event)
  9. {
  10. var comment = new Comment
  11. {
  12. Id = Guid.NewGuid(),
  13. Author = @event.Author,
  14. EMail = @event.EMail,
  15. Url = @event.Url,
  16. Occured = @event.Occured,
  17. PostId = @event.EventSourceId,
  18. Body = @event.Comment
  19. };
  20. InsertEntity(comment);
  21. }
  22. }
  23. }