PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
C# | 24 lines | 21 code | 3 blank | 0 comment | 0 complexity | eee68f13479715975eaed56ffcf98f89 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. using Bifrost.Events;
  2. using Bifrost.Samples.Blog.Events.Tags;
  3. namespace Bifrost.Samples.Blog.Views.Posts
  4. {
  5. public class PostTagEventSubscriber : EventSubscriber<PostTag>
  6. {
  7. public void Process(TagCreated @event)
  8. {
  9. var postTag = new PostTag {Id = @event.EventSourceId};
  10. InsertEntity(postTag);
  11. }
  12. public void Process(TagNameSet @event)
  13. {
  14. UpdateProperty(@event, p => p.Name = @event.TagName);
  15. }
  16. public void Process(TagDeleted @event)
  17. {
  18. DeleteEntity(@event);
  19. }
  20. }
  21. }