public async Task <IActionResult> RankComment([FromBody] CommentsViewModel commentsViewModel) { var originalUser = await _helpService.ExistUser(User); if (originalUser == null) { return(BadRequest()); } if (commentsViewModel.Id > 0 && commentsViewModel.Rank > 0) { var user = await _catalogService.GetUserByOriginalId(originalUser.Id); var amountRanks = await _catalogService.CheckRankUser(commentsViewModel.Id, user.Id); if (amountRanks > 0) { return(BadRequest()); } await _catalogService.AddRankForComment(commentsViewModel.Id, commentsViewModel.Rank, user.Id); return(Ok()); } return(BadRequest()); }