Exemple #1
0
        public IActionResult ReportCommentAjax(int postId, int commentId, int type)
        {
            if (!_workContext.CurrentCustomer.IsRegistered())
            {
                return(Unauthorized());
            }
            var post = _postService.GetPost(postId, "");

            if (post == null)
            {
                return(BadRequest());
            }

            var comment = _commentService.GetCommentById(commentId);

            if (comment == null)
            {
                return(BadRequest());
            }

            if (type <= 0)
            {
                return(BadRequest());
            }

            var report = new Z_Harag_CommentReport
            {
                CommentId      = commentId,
                ReportCategory = (byte)type,
                ReporterUser   = _workContext.CurrentCustomer.Id
            };

            var result = _commentService.ReportComment(report);

            if (result != null)
            {
                Ok(new { stat = true });
            }

            return(Ok(new { stat = false }));
        }
Exemple #2
0
 public Z_Harag_CommentReport ReportComment(Z_Harag_CommentReport model)
 {
     _reportRepository.Insert(model);
     return(model);
 }