public IActionResult Approve(int commentId)
        {
            var result        = _commentService.Approve(commentId, LoggedInUser.UserName);
            var commentResult = JsonSerializer.Serialize(result, new JsonSerializerOptions
            {
                ReferenceHandler = ReferenceHandler.Preserve
            });

            return(Json(commentResult));
        }
Пример #2
0
        public async Task <IHttpActionResult> ChangeApproveState(List <Guid> ids)
        {
            IHttpActionResult res = BadRequest();
            var serviceRes        = await _commentService.Approve(new CommentApproveRequest()
            {
                Ids          = ids,
                RequestOwner = User
            });

            if (serviceRes.Access == ResponseAccess.Deny)
            {
                res = Unauthorized(serviceRes.Message);
            }

            if (serviceRes.Access == ResponseAccess.Granted)
            {
                res = Ok(serviceRes);
            }

            return(res);
        }
        public void Approve(int commentId, int authorId)
        {
            // the authorId parameter will be used in near future for logging purposes.

            commentService.Approve(commentId);
        }
Пример #4
0
 public virtual ActionResult Approve(int id)
 {
     _commentService.Approve(id);
     _uow.SaveChanges();
     return(RenderApproveButtons(id, "disapproved"));
 }