/// <summary> /// Initializes a new instance of the <see cref="CommentViewModel"/> class. /// </summary> /// <param name="thread">The thread that the comment is a part of.</param> /// <param name="currentUser">The current user.</param> /// <param name="model">The comment model.</param> public CommentViewModel( ICommentThreadViewModel thread, IAccount currentUser, ICommentModel model) : this(thread, currentUser, model.Id, model.Body, CommentEditState.None, model.User, model.CreatedAt) { }
public async Task <ICommentModel> CreateAsync(ICommentModel newComment) { var comment = mapper.Map <Comment>(newComment); if (String.IsNullOrEmpty(comment.Text)) { throw new AppException("Comment cannot be empty!"); } comment.Id = Guid.NewGuid(); comment.DateCreated = DateTime.Now; comment.DateUpdated = DateTime.Now; await commentRepository.CreateAsync(comment); return(mapper.Map <ICommentModel>(comment)); }
public CommentService(ICommentModel commentModel) { ComposContainer.Instance().Compose(this); _commentModel = commentModel; }
public CommentController() { _iCommentModel = new CommentModel(); }