PageRenderTime 18ms CodeModel.GetById 15ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Source/Samples/Blog/Bifrost.Samples.Blog.Views/Blogs/BlogEventSubscriber.cs

#
C# | 29 lines | 25 code | 4 blank | 0 comment | 0 complexity | c1cf2e37f0642e77bac152af8b7c22d8 MD5 | raw file
 1using Bifrost.Events;
 2using Bifrost.Samples.Blog.Events.Blogs;
 3
 4namespace Bifrost.Samples.Blog.Views.Blogs
 5{
 6    public class BlogEventSubscriber : EventSubscriber<Blog>
 7    {
 8        public void Process(BlogCreated @event)
 9        {
10            var blog = new Blog {Id = @event.EventSourceId};
11            InsertEntity(blog);
12        }
13
14        public void Process(BlogNameSet @event)
15        {
16            UpdateProperty(@event, b => b.Name = @event.BlogName);
17        }
18
19        public void Process(BlogTagLineSet @event)
20        {
21            UpdateProperty(@event, b => b.TagLine = @event.TagLine);
22        }
23
24        public void Process(BlogOwnerAssigned @event)
25        {
26            UpdateProperty(@event, b => b.Owner = @event.Owner);
27        }
28    }
29}