PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/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
 1using System;
 2using Bifrost.Events;
 3using Bifrost.Samples.Blog.Events.Posts;
 4
 5namespace Bifrost.Samples.Blog.Views.Posts
 6{
 7	public class CommentEventSubscriber : EventSubscriber<Comment>
 8	{
 9		public void Process(CommentAdded @event)
10		{
11			var comment = new Comment
12			              	{
13			              		Id = Guid.NewGuid(),
14			              		Author = @event.Author,
15			              		EMail = @event.EMail,
16			              		Url = @event.Url,
17			              		Occured = @event.Occured,
18			              		PostId = @event.EventSourceId,
19			              		Body = @event.Comment
20			              	};
21			InsertEntity(comment);
22		}
23	}
24}