public async Task <IActionResult> DeleteComment(int userId, int commentId) { if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var comment = await _articlesRepo.GetArticleComment(commentId); if (comment == null) { return(NotFound()); } if (comment.UserId != userId) { return(Unauthorized()); } _boardologyRepo.Delete(comment); if (await _boardologyRepo.SaveAll()) { return(Ok()); } return(BadRequest("Failed to delete comment")); }