コード例 #1
0
		public void Handle(AddCommentToPost addCommentToPost)
		{
			var post = _repository.Get(addCommentToPost.Id);
			post.AddComment(
				addCommentToPost.Author, 
				addCommentToPost.EMail, 
				addCommentToPost.Url, 
				addCommentToPost.Comment, 
				addCommentToPost.Occured);
			
		}
コード例 #2
0
		public ActionResult AddComment(AddCommentToPost addComment)
		{
			var post = _posts.Get(addComment.Id);
			if (ModelState.IsValid)
			{
				var saga = GetOrCreateSagaOfComments(post);
				_sagaNarrator.TransitionTo<Comments>(saga);
				addComment.Occured = DateTime.Now;
				_commandCoordinator.Handle(saga, addComment);
			}
			return View("Show", GetPostViewModelFromPost(post));
		}