public async Task <IActionResult> Delete(Guid id)
        {
            var token   = GetToken();
            var userId  = LoginHelper.GetClaim(token, "UserId");
            var comment = await _commentRepository.GetByIdAsync(id);

            if (comment.UserId != Guid.Parse(userId))
            {
                return(Unauthorized());
            }
            await _commentAppService.Delete(id);

            return(Ok());
        }
예제 #2
0
 public IActionResult Delte(int id)
 {
     if (_commentAppService.GetById(id) == null)
     {
         throw new Exception("Không tồn tại Id");
     }
     else
     {
         var cmt = _commentAppService.Delete(id);
         return(Ok());
     }
 }