public void Post(CommentModel model) { validator.ValidateForPost(model); var newComment = commentMapper.Map(model); addEntityCommand.Execute(newComment); }
public Comment Map(CommentModel model) { var blogPost = getEntityByIdQuery.Execute<BlogPost>(model.BlogPostId); var currentUser = getCurrentUserQuery.Execute(); return new Comment { Text = model.Comment, BlogPost = blogPost, AddedBy = currentUser, DateAdded = DateTime.Now }; }
public void ValidateForPost(CommentModel model) { model.Comment.Should().NotBeNullOrWhiteSpace(because: "Some text is required"); }
public void Post(CommentModel model) { SentModel = model; commentController.Post(model); }