PageRenderTime 17ms CodeModel.GetById 14ms app.highlight 1ms RepoModel.GetById 1ms 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
 1using Bifrost.Events;
 2using Bifrost.Samples.Blog.Events.Tags;
 3
 4namespace Bifrost.Samples.Blog.Views.Posts
 5{
 6    public class PostTagEventSubscriber : EventSubscriber<PostTag>
 7    {
 8        public void Process(TagCreated @event)
 9        {
10            var postTag = new PostTag {Id = @event.EventSourceId};
11            InsertEntity(postTag);
12        }
13
14        public void Process(TagNameSet @event)
15        {
16            UpdateProperty(@event, p => p.Name = @event.TagName);
17        }
18
19        public void Process(TagDeleted @event)
20        {
21            DeleteEntity(@event);
22        }
23    }
24}