Ejemplo n.º 1
0
 /// <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)
 {
 }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 public CommentService(ICommentModel commentModel)
 {
     ComposContainer.Instance().Compose(this);
     _commentModel = commentModel;
 }
Ejemplo n.º 4
0
 public CommentController()
 {
     _iCommentModel = new CommentModel();
 }