public virtual PartialViewResult Delete()
        {
            var deleteCommentId = FullContext.Value.EntityId.Value;
            var commentsTarget  = FullContext.GetCommentsTarget();
            var targetEntityId  = commentsTarget.EntityId.Value;

            var comment = _commentsService.Get(deleteCommentId);

            if (!_commentsService.CanDelete(comment, _intranetMemberService.GetCurrentMemberId()))
            {
                return(OverView(comment.ActivityId));
            }

            var command = new RemoveCommentCommand(FullContext, deleteCommentId);

            _commandPublisher.Publish(command);

            switch (commentsTarget.Type.ToInt())
            {
            case int type
                when ContextExtensions.HasFlagScalar(type, ContextType.Activity | ContextType.PagePromotion):
                var activityCommentsInfo = GetActivityComments(targetEntityId);

                return(OverView(activityCommentsInfo));

            default:
                return(OverView(comment.ActivityId));
            }
        }
        public virtual PartialViewResult Add(CommentCreateModel model)
        {
            var commentsTarget = FullContext.GetCommentsTarget();
            var targetEntityId = commentsTarget.EntityId.Value;

            if (!ModelState.IsValid)
            {
                return(OverView(targetEntityId));
            }

            var createDto = MapToCreateDto(model, targetEntityId);
            var command   = new AddCommentCommand(FullContext, createDto);

            _commandPublisher.Publish(command);

            OnCommentCreated(createDto.Id);

            switch (commentsTarget.Type.ToInt())
            {
            case int type
                when ContextExtensions.HasFlagScalar(type, ContextType.Activity | ContextType.PagePromotion):
                var activityCommentsInfo = GetActivityComments(targetEntityId);

                return(OverView(activityCommentsInfo));

            default:
                return(OverView(targetEntityId));
            }
        }
        public virtual PartialViewResult Edit(CommentEditModel model)
        {
            var editCommentId  = FullContext.Value.EntityId.Value;
            var commentsTarget = FullContext.GetCommentsTarget();
            var targetEntityId = commentsTarget.EntityId.Value;

            if (!ModelState.IsValid)
            {
                return(OverView(editCommentId));
            }

            var comment = _commentsService.Get(editCommentId);

            if (!_commentsService.CanEdit(comment, _intranetUserService.GetCurrentUserId()))
            {
                return(OverView(editCommentId));
            }

            var editDto = MapToEditDto(model, editCommentId);
            var command = new EditCommentCommand(FullContext, editDto);

            _commandPublisher.Publish(command);

            switch (commentsTarget.Type.ToInt())
            {
            case int type when ContextExtensions.HasFlagScalar(type, ContextType.Activity | ContextType.PagePromotion):
                var activityCommentsInfo = GetActivityComments(targetEntityId);

                return(OverView(activityCommentsInfo));

            default:
                return(OverView(comment.ActivityId));
            }
        }